Java 类javax.persistence.criteria.AbstractQuery 实例源码
项目:linq
文件:LinqImpl.java
protected void applyPredicateToCriteria(AbstractQuery<?> query) {
Predicate predicate = parsePredicate(junction);
if (predicate != null) {
query.where(predicate);
}
predicate = parsePredicate(having);
if (predicate != null) {
query.having(predicate);
}
if (query instanceof CriteriaQuery) {
if (!CollectionUtils.isEmpty(orders)) {
((CriteriaQuery<?>) query).orderBy(orders);
}
}
}
项目:jpasecurity
文件:CriteriaVisitor.java
/**
* {@inheritDoc}
*/
public boolean visit(JpqlWhere node, CriteriaHolder query) {
AbstractQuery<?> criteriaQuery = query.getCurrentQuery();
Predicate restriction = criteriaQuery.getRestriction();
node.jjtGetChild(0).visit(this, query);
if (query.isValueOfType(Predicate.class)) {
if (restriction == null) {
criteriaQuery.where(query.<Predicate>getCurrentValue());
} else {
criteriaQuery.where(restriction, query.<Predicate>getCurrentValue());
}
} else {
if (restriction == null) {
criteriaQuery.where(query.<Expression<Boolean>>getCurrentValue());
} else {
criteriaQuery.where(restriction, builder.isTrue(query.<Expression<Boolean>>getCurrentValue()));
}
}
return false;
}
项目:jpasecurity
文件:CriteriaVisitor.java
/**
* {@inheritDoc}
*/
public boolean visit(JpqlFromItem node, CriteriaHolder criteriaHolder) {
AbstractQuery<?> query = criteriaHolder.getCurrentQuery();
String entityName = node.jjtGetChild(0).toString();
Alias alias = getAlias(node);
Class<?> entityType = ManagedTypeFilter.forModel(metamodel).filter(entityName.trim()).getJavaType();
query.from(entityType).alias(alias.getName());
return false;
}
项目:jpasecurity
文件:CriteriaHolder.java
private From<?, ?> getFrom(CommonAbstractCriteria query, Alias alias) {
if (query instanceof CriteriaUpdate) {
return ((CriteriaUpdate<?>)query).getRoot();
} else if (query instanceof CriteriaDelete) {
return ((CriteriaUpdate<?>)query).getRoot();
} else {
return getFrom((AbstractQuery<?>)query, alias);
}
}
项目:jpasecurity
文件:CriteriaHolder.java
private From<?, ?> getFrom(AbstractQuery<?> query, Alias alias) {
for (Root<?> root: query.getRoots()) {
From<?, ?> from = getFrom(root, alias);
if (from != null) {
return from;
}
}
return null;
}
项目:jpasecurity
文件:CriteriaEntityFilter.java
private Set<Alias> getAliases(AbstractQuery<?> query) {
Set<Alias> aliases = new HashSet<Alias>();
for (Root<?> root: query.getRoots()) {
if (root.getAlias() != null) {
aliases.add(new Alias(root.getAlias()));
}
}
return aliases;
}
项目:jpasecurity
文件:CriteriaHolder.java
public <R> AbstractQuery<R> getCurrentQuery() {
if (subqueries.isEmpty()) {
return (CriteriaQuery<R>)criteriaQuery;
}
return (Subquery<R>)subqueries.peek();
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> where(Expression<Boolean> restriction) {
return null;
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> where(Predicate... restrictions) {
return null;
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> groupBy(Expression<?>... grouping) {
return null;
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> groupBy(List<Expression<?>> grouping) {
return null;
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> having(Expression<Boolean> restriction) {
return null;
}
项目:hibernate-semantic-query
文件:AbstractCriteriaQueryImpl.java
@Override
public AbstractQuery<T> having(Predicate... restrictions) {
return null;
}
项目:hibernate-semantic-query
文件:JpaQuerySpecImpl.java
public JpaQuerySpecImpl(AbstractQuery<T> owner, CriteriaBuilderImpl criteriaBuilder) {
this.owner = owner;
this.criteriaBuilder = criteriaBuilder;
this.isSubQuery = Subquery.class.isInstance( owner );
}