hibernate/hibernate-orm · error · StrictJpaComplianceViolation

Encountered non-compliant non-standard function call [{origi

Error message

Encountered non-compliant non-standard function call [{originalFunctionName}], but strict JPA compliance was requested; use FUNCTION(functionName[,...]) syntax name instead

What it means

Error "Encountered non-compliant non-standard function call [{originalFunctionName}], but strict JPA compliance was requested; use FUNCTION(functionName[,...]) syntax name instead" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:4639

				? OBJECT_BASIC_TYPE
				: (BasicType<?>) visitCastTarget( castTarget ).getType();
	}

	@Override
	public String visitGenericFunctionName(HqlParser.GenericFunctionNameContext ctx) {
		final var functionName = new StringBuilder( visitIdentifier( ctx.simplePath().identifier() ) );
		for ( var sp: ctx.simplePath().simplePathElement() ) {
			// allow function names of form foo.bar to be located in the registry
			functionName.append('.').append( visitIdentifier( sp.identifier() ) );
		}
		return functionName.toString();
	}

	private String getFunctionName(HqlParser.GenericFunctionContext ctx) {
		final String originalFunctionName = visitGenericFunctionName( ctx.genericFunctionName() );
		final String functionName = originalFunctionName.toLowerCase();
		if ( creationOptions.useStrictJpaCompliance() && !JPA_STANDARD_FUNCTIONS.contains( functionName ) ) {
			throw new StrictJpaComplianceViolation(
					"Encountered non-compliant non-standard function call [" +
							originalFunctionName + "], but strict JPA " +
							"compliance was requested; use FUNCTION(functionName[,...]) " +
							"syntax name instead",
					StrictJpaComplianceViolation.Type.FUNCTION_CALL
			);
		}
		return functionName;
	}

	@Override
	public Object visitGenericFunction(HqlParser.GenericFunctionContext ctx) {
		final var functionTemplate = getFunctionTemplate(  ctx );
		final var functionArguments = getFunctionArguments( ctx );
		final var filterExpression = getFilterExpression( ctx );
		final var function = switch ( functionTemplate.getFunctionKind() ) {
			case ORDERED_SET_AGGREGATE -> functionTemplate.generateOrderedSetAggregateSqmExpression(
					functionArguments,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Under strict JPA compliance only portable function calls are allowed. Replace the non-standard function call with the JPA FUNCTION('name', ...) syntax, or disable strict JPA compliance.

When it happens

Trigger: An HQL-specific construct is used while strict JPQL compliance is enabled: Encountered non-compliant non-standard function call [<value>], but strict JPA compliance was requested; use FUNCTION(functionName[,...]) syntax name instead

Common situations: Applications running with hibernate.jpa.compliance.query=true (or JPA-compliance mode) that submit queries using Hibernate extensions such as collations, tuples/row value constructors, HQL collection functions (maxelement/elements/indices), value()/key() on non-Map types, or non-standard function calls without FUNCTION() syntax.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/2d3d61f262dab804. Report an issue: GitHub.