if (etx != null && !etx.isActive()) {
etx.begin();
}
CustomJPAQuery query = jpaQuery.getQuery().clone(em);
if (distinct != null && distinct.equals(Boolean.TRUE)) {
query = query.distinct();
}
Object result;
if (singleResult == null || singleResult.equals(Boolean.FALSE)) {
if (maxRes != 0) {
if (!returnCount) {