hibernate/hibernate-orm · error · StrictJpaComplianceViolation
VALUE_FUNCTION_ON_NON_MAP
VALUE_FUNCTION_ON_NON_MAP
Error message
Strict JPA query language compliance was violated: use of value() function for non-Map type
What it means
Error "Strict JPA query language compliance was violated: use of value() function for non-Map type" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:5990
if ( madeNested ) {
qualifiedJoinPathConsumer.setNested( true );
}
}
else {
madeNested = false;
}
final var sqmPath = consumeDomainPath( ctx.path() );
final boolean hasContinuation = ctx.getChildCount() == 5;
final var referencedPathSource = sqmPath.getReferencedPathSource();
final var firstNode = (TerminalNode) ctx.elementValueQuantifier().getChild(0);
checkPluralPath( sqmPath, referencedPathSource, firstNode );
if ( getCreationOptions().useStrictJpaCompliance() ) {
final var attribute = (PluralPersistentAttribute<?, ?, ?>) referencedPathSource;
if ( attribute.getCollectionClassification() != CollectionClassification.MAP
&& firstNode.getSymbol().getType() == HqlParser.VALUE ) {
throw new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.VALUE_FUNCTION_ON_NON_MAP );
}
}
SqmPath<?> result;
if ( consumer instanceof QualifiedJoinPathConsumer qualifiedJoinPathConsumer ) {
if ( madeNested && !hasContinuation ) {
// Reset the nested state before consuming the terminal identifier
qualifiedJoinPathConsumer.setNested( false );
}
consumer.consumeIdentifier( CollectionPart.Nature.ELEMENT.getName(), false, !hasContinuation );
result = (SqmPath<?>) consumer.getConsumedPart();
}
else {
result = sqmPath.resolvePathPart( CollectionPart.Nature.ELEMENT.getName(), true, this );
}
if ( hasContinuation ) {
if ( madeNested ) {View on GitHub (pinned to fad1729dce)
Solutions
- value() is only valid for Map associations, and strict JPA compliance was violated. Use value() only on map-valued paths, or relax compliance.
When it happens
Trigger: An HQL-specific construct is used while strict JPQL compliance is enabled: Strict JPA query language compliance was violated: use of value() function for non-Map type
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/a4a6c9aa7597ec5b.
Report an issue: GitHub.