use of eu.europa.ec.fisheries.uvms.exchange.search.ExchangeSearchField in project UVMS-ExchangeModule-APP by UnionVMS.
the class ExchangeLogDaoBean method getExchangeLogListPaginated.
@Override
public List<ExchangeLog> getExchangeLogListPaginated(Integer page, Integer listSize, String sql, List<SearchValue> searchKeyValues) throws ExchangeDaoException {
try {
LOG.debug("SQL QUERY IN LIST PAGINATED: " + sql);
TypedQuery<ExchangeLog> query = em.createQuery(sql, ExchangeLog.class);
HashMap<ExchangeSearchField, List<SearchValue>> orderedValues = SearchFieldMapper.combineSearchFields(searchKeyValues);
setQueryParameters(query, orderedValues);
query.setFirstResult(listSize * (page - 1));
query.setMaxResults(listSize);
return query.getResultList();
} catch (IllegalArgumentException e) {
LOG.error("[ Error getting exchangelog list paginated ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when getting list ] ");
} catch (Exception e) {
LOG.error("[ Error getting exchangelog list paginated ] {}", e.getMessage());
throw new ExchangeDaoException("[ Error when getting list ] ");
}
}
Aggregations