Search in sources :

Example 11 with SqmFunctionDescriptor

use of org.hibernate.query.sqm.function.SqmFunctionDescriptor in project hibernate-orm by hibernate.

the class SqmCriteriaNodeBuilder method function.

@Override
public <T> SqmFunction<T> function(String name, Class<T> type, Expression<?>[] args) {
    SqmFunctionDescriptor functionTemplate = getFunctionDescriptor(name);
    final BasicType<T> resultType = getTypeConfiguration().getBasicTypeForJavaType(type);
    if (functionTemplate == null) {
        functionTemplate = new NamedSqmFunctionDescriptor(name, true, null, StandardFunctionReturnTypeResolvers.invariant(resultType), null);
    }
    return functionTemplate.generateSqmExpression(expressionList(args), resultType, getQueryEngine(), getJpaMetamodel().getTypeConfiguration());
}
Also used : NamedSqmFunctionDescriptor(org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor) NamedSqmFunctionDescriptor(org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor) SqmFunctionDescriptor(org.hibernate.query.sqm.function.SqmFunctionDescriptor)

Aggregations

SqmFunctionDescriptor (org.hibernate.query.sqm.function.SqmFunctionDescriptor)11 NamedSqmFunctionDescriptor (org.hibernate.query.sqm.function.NamedSqmFunctionDescriptor)4 SqmTypedNode (org.hibernate.query.sqm.tree.SqmTypedNode)3 SqmExpression (org.hibernate.query.sqm.tree.expression.SqmExpression)3 ParseTree (org.antlr.v4.runtime.tree.ParseTree)2 SemanticException (org.hibernate.query.SemanticException)2 StrictJpaComplianceViolation (org.hibernate.query.sqm.StrictJpaComplianceViolation)2 AbstractSqmFunctionDescriptor (org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor)2 SqmPredicate (org.hibernate.query.sqm.tree.predicate.SqmPredicate)2 SqmOrderByClause (org.hibernate.query.sqm.tree.select.SqmOrderByClause)2 SqlAppender (org.hibernate.sql.ast.spi.SqlAppender)2 TestForIssue (org.hibernate.testing.TestForIssue)2 BasicType (org.hibernate.type.BasicType)2 TypeConfiguration (org.hibernate.type.spi.TypeConfiguration)2 Test (org.junit.Test)2 Expression (jakarta.persistence.criteria.Expression)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TerminalNode (org.antlr.v4.runtime.tree.TerminalNode)1