List of usage examples for javax.persistence.criteria CriteriaBuilder coalesce
<Y> Expression<Y> coalesce(Expression<? extends Y> x, Y y);
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.criteria.CriteriaTranslatorImpl.java
protected void addSorting(CriteriaBuilder criteriaBuilder, List<Order> sorts, FilterMapping filterMapping, Path path) {//w w w.ja v a 2 s. c o m Expression exp = path; if (filterMapping.getNullsLast() != null && filterMapping.getNullsLast()) { Object largeValue = getAppropriateLargeSortingValue(path.getJavaType()); if (largeValue != null) { exp = criteriaBuilder.coalesce(path, largeValue); } } if (SortDirection.ASCENDING == filterMapping.getSortDirection()) { sorts.add(criteriaBuilder.asc(exp)); } else { sorts.add(criteriaBuilder.desc(exp)); } }