// use it when you need only currency objects
  public List<CurrencyDTO> getCurrenciesWithoutRates(
      Integer languageId, Integer entityId, boolean inUseOnly)
      throws NamingException, SQLException {

    String cacheKey = "without rates " + getCacheKey(languageId, entityId, new Date());
    List<CurrencyDTO> cachedCurrencies =
        (List<CurrencyDTO>) cache.getFromCache(cacheKey, cacheModel);

    if (cachedCurrencies != null && !cachedCurrencies.isEmpty()) {
      LOG.debug("Cache hit for %s", cacheKey);
      return cachedCurrencies;
    }

    List<CurrencyDTO> currencies = new CurrencyDAS().findAll();

    boolean inUse;
    for (CurrencyDTO currency : currencies) {
      set(currency.getId());
      inUse = entityHasCurrency(entityId, currency.getId());
      if (inUseOnly && !inUse) continue;
      currency.setInUse(inUse);
      currency.setName(this.currency.getDescription(languageId));

      // find system rate
      if (currency.getId() == SYSTEM_CURRENCY_ID.intValue()) {
        currency.setSysRate(SYSTEM_CURRENCY_RATE_DEFAULT);
      }
    }
    cache.putInCache(cacheKey, cacheModel, currencies);
    return currencies;
  }
  public List<CurrencyDTO> getCurrenciesToDate(Integer languageId, Integer entityId, Date to)
      throws NamingException, SQLException {

    String cacheKey = getCacheKey(languageId, entityId, to);
    List<CurrencyDTO> cachedCurrencies =
        (List<CurrencyDTO>) cache.getFromCache(cacheKey, cacheModel);

    if (cachedCurrencies != null && !cachedCurrencies.isEmpty()) {
      LOG.debug("Cache hit for %s", cacheKey);
      return cachedCurrencies;
    }

    List<CurrencyDTO> currencies = new CurrencyDAS().findAll();

    for (CurrencyDTO currency : currencies) {
      set(currency.getId());
      currency.setName(this.currency.getDescription(languageId));

      // find system rate
      if (currency.getId() == SYSTEM_CURRENCY_ID.intValue()) {
        currency.setSysRate(SYSTEM_CURRENCY_RATE_DEFAULT);
      } else {
        final CurrencyExchangeDTO exchangeRateForDate =
            findExchange(SYSTEM_RATE_ENTITY_ID, currency.getId(), to);
        currency.setSysRate(exchangeRateForDate.getRate());
      }

      // find entity specific rate
      CurrencyExchangeDTO exchange =
          exchangeDas.getExchangeRateForDate(entityId, currency.getId(), to);
      if (exchange != null) {
        currency.setRate(exchange.getRate().toString());
      }

      // set in-use flag
      currency.setInUse(entityHasCurrency(entityId, currency.getId()));
    }

    cache.putInCache(cacheKey, cacheModel, currencies);

    return currencies;
  }
 public void invalidateCache() {
   LOG.debug("Invalidating currency cache");
   cache.flushCache(flushModel);
 }