本文整理了Java中javax.persistence.criteria.CriteriaQuery.getGroupList()
方法的一些代码示例,展示了CriteriaQuery.getGroupList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CriteriaQuery.getGroupList()
方法的具体详情如下:
包路径:javax.persistence.criteria.CriteriaQuery
类名称:CriteriaQuery
方法名:getGroupList
暂无
代码示例来源:origin: katharsis-project/katharsis-framework
@Override
@SuppressWarnings({ "rawtypes" })
public long getTotalRowCount() {
Selection<T> selection = query.getSelection();
List<Order> orderList = query.getOrderList();
try {
CriteriaBuilder builder = em.getCriteriaBuilder();
Expression<Long> countExpr;
Set<Root<?>> roots = query.getRoots();
if (roots.size() != 1) {
throw new IllegalStateException("cannot compute totalRowCount in case of multiple query roots");
}
if (!query.getGroupList().isEmpty()) {
throw new IllegalStateException("cannot compute totalRowCount for grouped queries");
}
// transform query to a count query
Root root = roots.iterator().next();
countExpr = builder.count(root);
query.multiselect(countExpr);
query.orderBy(new ArrayList<Order>());
TypedQuery countQuery = em.createQuery(query);
return (Long) countQuery.getSingleResult();
}
finally {
// transform count query back to regular query
query.multiselect(selection);
query.orderBy(orderList);
}
}
代码示例来源:origin: com.walterjwhite.infrastructure.datastore.modules/google-guice-persist-criteria-builder
/** Use ES here, it would be more efficient. */
public void search() {
// criteriaBuilder.equal()
CriteriaQuery<Long> criteriaQuery = null;
criteriaQuery.getParameters();
criteriaQuery.getGroupList();
criteriaQuery.getOrderList();
criteriaQuery.getGroupRestriction();
criteriaQuery.getRestriction();
criteriaQuery.getSelection();
final Predicate predicate = null;
}
}
代码示例来源:origin: org.jboss.pressgang.ccms/pressgang-ccms-query
/**
* Copy Criteria without Selection
*
* @param from source Criteria
* @param to destination Criteria
*/
public static void copyCriteriaNoSelection(CriteriaQuery<?> from, CriteriaQuery<?> to) {
// Copy Roots
for (Root<?> root : from.getRoots()) {
Root<?> dest = to.from(root.getJavaType());
dest.alias(getOrCreateAlias(root));
copyJoins(root, dest);
}
if (from.getGroupList() != null) to.groupBy(from.getGroupList());
to.distinct(from.isDistinct());
if (from.getGroupRestriction() != null) to.having(from.getGroupRestriction());
if (from.getRestriction() != null) to.where(from.getRestriction());
if (from.getOrderList() != null) to.orderBy(from.getOrderList());
}
内容来源于网络,如有侵权,请联系作者删除!