本文整理了Java中javax.persistence.criteria.CriteriaQuery.getSelection()
方法的一些代码示例,展示了CriteriaQuery.getSelection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CriteriaQuery.getSelection()
方法的具体详情如下:
包路径:javax.persistence.criteria.CriteriaQuery
类名称:CriteriaQuery
方法名:getSelection
暂无
代码示例来源:origin: kiegroup/jbpm
@Override
protected <T,R> Expression getOrderByExpression(CriteriaQuery<R> query, Class<T> queryType, String orderByListId) {
List<Selection<?>> selections = query.getSelection().getCompoundSelectionItems();
Selection orderBySelection = null;
if( orderByListId.equals(QueryParameterIdentifiers.TASK_ID_LIST) ) {
orderBySelection = selections.get(0);
} else if( orderByListId.equals(QueryParameterIdentifiers.TASK_NAME_LIST) ) {
orderBySelection = selections.get(1);
} else if( orderByListId.equals(QueryParameterIdentifiers.TASK_STATUS_LIST) ) {
orderBySelection = selections.get(4);
} else if( orderByListId.equals(QueryParameterIdentifiers.CREATED_BY_LIST) ) {
orderBySelection = selections.get(8);
} else if( orderByListId.equals(QueryParameterIdentifiers.CREATED_ON_LIST) ) {
orderBySelection = selections.get(9);
} else if( orderByListId.equals(QueryParameterIdentifiers.PROCESS_INSTANCE_ID_LIST) ) {
orderBySelection = selections.get(14);
}
return (Expression<?>) orderBySelection;
}
代码示例来源:origin: Impetus/Kundera
Selection<S> select = criteriaQuery.getSelection();
代码示例来源:origin: org.jboss.pressgang.ccms/pressgang-ccms-query
public static <T> void copyCriteria(CriteriaQuery<T> from, CriteriaQuery<T> to) {
copyCriteriaNoSelection(from, to);
to.select(from.getSelection());
}
代码示例来源:origin: katharsis-project/katharsis-framework
@Override
protected boolean isCompoundSelection() {
return query.getSelection().isCompoundSelection();
}
代码示例来源:origin: org.jbpm/jbpm-human-task-jpa
@Override
protected <T,R> Expression getOrderByExpression(CriteriaQuery<R> query, Class<T> queryType, String orderByListId) {
List<Selection<?>> selections = query.getSelection().getCompoundSelectionItems();
Selection orderBySelection = null;
if( orderByListId.equals(QueryParameterIdentifiers.TASK_ID_LIST) ) {
orderBySelection = selections.get(0);
} else if( orderByListId.equals(QueryParameterIdentifiers.TASK_NAME_LIST) ) {
orderBySelection = selections.get(1);
} else if( orderByListId.equals(QueryParameterIdentifiers.TASK_STATUS_LIST) ) {
orderBySelection = selections.get(4);
} else if( orderByListId.equals(QueryParameterIdentifiers.CREATED_BY_LIST) ) {
orderBySelection = selections.get(8);
} else if( orderByListId.equals(QueryParameterIdentifiers.CREATED_ON_LIST) ) {
orderBySelection = selections.get(9);
} else if( orderByListId.equals(QueryParameterIdentifiers.PROCESS_INSTANCE_ID_LIST) ) {
orderBySelection = selections.get(14);
}
return (Expression<?>) orderBySelection;
}
代码示例来源:origin: katharsis-project/katharsis-framework
@Override
public void addSelection(Expression<?> expression, String name) {
Selection<?> selection = criteriaQuery.getSelection();
List<Selection<?>> newSelection = new ArrayList<>();
if (selection != null) {
if (selection.isCompoundSelection()) {
newSelection.addAll(selection.getCompoundSelectionItems());
}
else {
newSelection.add(selection);
}
}
newSelection.add(expression);
criteriaQuery.multiselect(newSelection);
}
代码示例来源: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.thinkbiganalytics.kylo/kylo-operational-metadata-jpa
@Override
public <S, T, ID extends Serializable> Specification<S> augment(Specification<S> spec, Class<S> domainClass,
JpaEntityInformation<T, ID> entityInformation) {
LOG.debug("QueryAugmentor.augment");
return (root, query, criteriaBuilder) -> {
Root<JpaFeedOpsAclEntry> fromAcl = query.from(JpaFeedOpsAclEntry.class);
query.distinct(true);
if (query.getSelection() == null) {
query.select((Selection) root);
}
Path<Object> feedId = getFeedId(entityInformation, root);
javax.persistence.criteria.Predicate rootFeedIdEqualToAclFeedId = criteriaBuilder.equal(feedId, fromAcl.get("feedId"));
RoleSetExposingSecurityExpressionRoot userCxt = getUserContext();
javax.persistence.criteria.Predicate aclPrincipalInGroups = fromAcl.get("principalName").in(userCxt.getGroups());
javax.persistence.criteria.Predicate aclPrincipalTypeIsGroup = criteriaBuilder.equal(fromAcl.get("principalType"), FeedOpsAclEntry.PrincipalType.GROUP);
javax.persistence.criteria.Predicate acePrincipalGroupMatch = criteriaBuilder.and(aclPrincipalInGroups, aclPrincipalTypeIsGroup);
javax.persistence.criteria.Predicate aclPrincipalEqUser = criteriaBuilder.equal(fromAcl.get("principalName"), userCxt.getName());
javax.persistence.criteria.Predicate aclPrincipalTypeIsUser = criteriaBuilder.equal(fromAcl.get("principalType"), FeedOpsAclEntry.PrincipalType.USER);
javax.persistence.criteria.Predicate acePrincipalUserMatch = criteriaBuilder.and(aclPrincipalEqUser, aclPrincipalTypeIsUser);
javax.persistence.criteria.Predicate acePrincipalMatch = criteriaBuilder.or(acePrincipalGroupMatch, acePrincipalUserMatch);
javax.persistence.criteria.Predicate feedIdEqualsAndPrincipalMatch = criteriaBuilder.and(rootFeedIdEqualToAclFeedId, acePrincipalMatch);
if (spec != null) {
javax.persistence.criteria.Predicate predicate = spec.toPredicate(root, query, criteriaBuilder);
return criteriaBuilder.and(predicate, feedIdEqualsAndPrincipalMatch);
} else {
return feedIdEqualsAndPrincipalMatch;
}
};
}
代码示例来源: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.hibernate/com.springsource.org.hibernate.ejb
renderedCriteriaQuery.getQueryString(),
criteriaQuery.getResultType(),
criteriaQuery.getSelection(),
new HibernateEntityManagerImplementor.Options() {
public List<ValueHandlerFactory.ValueHandler> getValueHandlers() {
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
Selection<X> selection = criteriaQuery.getSelection();
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-mapper
Selection<X> selection = criteriaQuery.getSelection();
内容来源于网络,如有侵权,请联系作者删除!