@Override
public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> loadingFilters) {
Map<String, Object> copyOfFilters = new HashMap<String, Object>();
copyOfFilters.putAll(getFilters());
setRowCount((int) getPersistenceService().count(
new PaginationConfiguration(first, pageSize, copyOfFilters, getListFieldsToFetch(), sortField, sortOrder)));
if (getRowCount() > 0) {
copyOfFilters = new HashMap<String, Object>();
copyOfFilters.putAll(getFilters());
return getPersistenceService().list(
new PaginationConfiguration(first, pageSize, copyOfFilters, getListFieldsToFetch(), sortField, sortOrder));
} else {
return null; // no need to load then
}
}