本文整理了Java中javax.persistence.criteria.Subquery.groupBy()
方法的一些代码示例,展示了Subquery.groupBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subquery.groupBy()
方法的具体详情如下:
包路径:javax.persistence.criteria.Subquery
类名称:Subquery
方法名:groupBy
[英]Specify the expressions that are used to form groups over the subquery results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type of the corresponding AbstractQuery
method.
[中]指定用于在子查询结果上形成组的表达式。替换以前指定的分组表达式(如果有)。如果未指定分组表达式,则只需删除之前添加的任何分组表达式。此方法仅覆盖相应AbstractQuery
方法的返回类型。
代码示例来源:origin: kiegroup/jbpm
Root from = maxIdSubQuery.from(VariableInstanceLog.class);
maxIdSubQuery.select(builder.max(from.get(VariableInstanceLog_.id)));
maxIdSubQuery.groupBy(
from.get(VariableInstanceLog_.variableId),
from.get(VariableInstanceLog_.processInstanceId));
代码示例来源:origin: inspectIT/inspectIT
sq.select(cb.max(sqRoot.get("id").as(Long.class))).where(predicate).groupBy(sqRoot.get("jmxSensorDefinitionDataIdentId"));
代码示例来源:origin: org.jboss.pressgang.ccms/pressgang-ccms-query
protected Subquery<Integer> getLatestCompleteRevisionSubquery() {
final CriteriaBuilder criteriaBuilder = getCriteriaBuilder();
final Subquery<Integer> subQuery = getCriteriaQuery().subquery(Integer.class);
final Root<TranslatedTopicData> root = subQuery.from(TranslatedTopicData.class);
subQuery.select(criteriaBuilder.max(root.get("translatedTopic").get("topicRevision").as(Integer.class)));
final Predicate topicIdMatch = criteriaBuilder.equal(root.get("translatedTopic").get("topicId"), translatedTopic.get("topicId"));
final Predicate localeMatch = criteriaBuilder.equal(getOriginalRootPath().get("translationLocale"), root.get("translationLocale"));
final Predicate complete = criteriaBuilder.ge(root.get("translationPercentage").as(Integer.class), 100);
subQuery.where(criteriaBuilder.and(topicIdMatch, localeMatch, complete));
subQuery.groupBy(root.get("translatedTopic").get("topicId"));
return subQuery;
}
代码示例来源:origin: SAP/olingo-jpa-processor-v4
protected void handleAggregation(final Subquery<?> subQuery, final From<?, ?> subRoot,
final List<JPAOnConditionItem> conditionItems) throws ODataApplicationException {
final List<Expression<?>> groupByLIst = new ArrayList<>();
if (filterComplier != null && this.aggregationType != null) {
for (final JPAOnConditionItem onItem : conditionItems) {
Path<?> subPath = subRoot;
for (final JPAElement jpaPathElement : onItem.getRightPath().getPath())
subPath = subPath.get(jpaPathElement.getInternalName());
groupByLIst.add(subPath);
}
subQuery.groupBy(groupByLIst);
try {
subQuery.having(this.filterComplier.compile());
} catch (ExpressionVisitException e) {
throw new ODataJPAQueryException(e, HttpStatusCode.INTERNAL_SERVER_ERROR);
}
}
}
代码示例来源:origin: org.jboss.pressgang.ccms/pressgang-ccms-query
/**
* Create a Subquery to get the latest revision for a translated topic and locale.
*
* @return A subquery that will return the maximum revision for a translated topic and locale.
*/
protected Subquery<Integer> getLatestRevisionSubquery() {
final CriteriaBuilder criteriaBuilder = getCriteriaBuilder();
final Subquery<Integer> subQuery = getCriteriaQuery().subquery(Integer.class);
final Root<TranslatedTopicData> root = subQuery.from(TranslatedTopicData.class);
subQuery.select(criteriaBuilder.max(root.get("translatedTopic").get("topicRevision").as(Integer.class)));
final Predicate topicIdMatch = criteriaBuilder.equal(root.get("translatedTopic").get("topicId"), translatedTopic.get("topicId"));
final Predicate localeMatch = criteriaBuilder.equal(getOriginalRootPath().get("translationLocale"), root.get("translationLocale"));
subQuery.where(criteriaBuilder.and(topicIdMatch, localeMatch));
subQuery.groupBy(root.get("translatedTopic").get("topicId"));
return subQuery;
}
代码示例来源:origin: picketlink/picketlink
subQueryOwnerAttributesByValue.groupBy(selection).having(cb.equal(cb.count(selection), valuesLength));
代码示例来源:origin: picketlink/picketlink
subQueryOwnerAttributesByValue.groupBy(selection).having(cb.equal(cb.count(selection), valuesLength));
代码示例来源:origin: org.picketlink/picketlink-idm-impl
subquery.groupBy(subquery.getSelection()).having(
criteria.getBuilder().equal(criteria.getBuilder().count(subquery.getSelection()), parameterValues.length));
代码示例来源:origin: JoleneOL/market-manage
Root<MainOrder> root1 = subquery.from(MainOrder.class);
subquery = subquery.select(cb.least(root1.get(MainOrder_.orderTime)))
.groupBy(root1.get(MainOrder_.orderBy))
.where(cb.equal(root1.get(MainOrder_.orderBy), root), MainOrder.getOrderPaySuccess(root1, cb));
return cb.selectCase(cb.literal(true))
Root<MainOrder> root1 = subquery.from(MainOrder.class);
subquery = subquery.select(cb.sum(root1.get(MainOrder_.goodTotalPriceAmountIndependent)))
.groupBy(root1.get(MainOrder_.orderBy))
.where(cb.equal(root1.get(MainOrder_.orderBy), root), MainOrder.getOrderPaySuccess(root1, cb));
return cb.selectCase(cb.literal(true))
内容来源于网络,如有侵权,请联系作者删除!