use of org.hibernate.query.sqm.tree.expression.SqmEvery in project hibernate-orm by hibernate.
the class SemanticQueryBuilder method visitEveryFunction.
@Override
public SqmExpression<?> visitEveryFunction(HqlParser.EveryFunctionContext ctx) {
final SqmPredicate filterExpression = getFilterExpression(ctx);
final ParseTree argumentChild = ctx.getChild(2);
if (argumentChild instanceof HqlParser.SubqueryContext) {
final SqmSubQuery<?> subquery = (SqmSubQuery<?>) argumentChild.accept(this);
return new SqmEvery<>(subquery, creationContext.getNodeBuilder());
} else if (argumentChild instanceof HqlParser.PredicateContext) {
if (getCreationOptions().useStrictJpaCompliance()) {
throw new StrictJpaComplianceViolation(StrictJpaComplianceViolation.Type.FUNCTION_CALL);
}
final SqmExpression<?> argument = (SqmExpression<?>) argumentChild.accept(this);
return applyOverClause(ctx, getFunctionDescriptor("every").generateAggregateSqmExpression(singletonList(argument), filterExpression, resolveExpressibleTypeBasic(Boolean.class), creationContext.getQueryEngine(), creationContext.getJpaMetamodel().getTypeConfiguration()));
} else {
if (getCreationOptions().useStrictJpaCompliance()) {
throw new StrictJpaComplianceViolation(StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION);
}
return new SqmEvery<>(createCollectionReferenceSubQuery((HqlParser.SimplePathContext) ctx.getChild(3), (TerminalNode) ctx.getChild(1)), creationContext.getNodeBuilder());
}
}
Aggregations