hibernate/hibernate-orm · error · UnsupportedOperationException
Whatever JPA
Error message
Whatever JPA
What it means
SqmMapEntryReference models HQL/criteria ENTRY(m) - a syntactic construct that only makes sense as a select item yielding Map.Entry. JPA forces the Expression interface onto it, but an ENTRY has no comparable SQL value, so Hibernate implements isNull() as UnsupportedOperationException("Whatever JPA") - a deliberate marker for API surface that cannot be implemented.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/domain/SqmMapEntryReference.java:193
&& mapPath.isCompatible( that.mapPath )
&& Objects.equals( explicitAlias, that.explicitAlias );
}
@Override
public int cacheHashCode() {
int result = mapPath.cacheHashCode();
result = 31 * result + Objects.hashCode( explicitAlias );
return result;
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// JPA (ugh)
@Nonnull
@Override
public Predicate isNull() {
throw new UnsupportedOperationException( "Whatever JPA" );
}
@Nonnull
@Override
public Predicate isNotNull() {
throw new UnsupportedOperationException( "Whatever JPA" );
}
@Nonnull
@Override
public Predicate equalTo(@Nonnull Expression<?> value) {
throw new UnsupportedOperationException( "Whatever JPA" );
}
@Nonnull
@Override
public Predicate equalTo(Object value) {
throw new UnsupportedOperationException( "Whatever JPA" );View on GitHub (pinned to fad1729dce)
Solutions
- Rewrite the null-check against KEY(m) or VALUE(m): cb.isNull(mapJoin.value()) or cb.isNotNull(mapJoin.key())
- Test map emptiness instead: size(m) = 0 / cb.isEmpty
- If ENTRY(m) is only needed as a projection, select it into Java and filter there
- Make generic predicate code skip SqmMapEntryReference expressions
Example fix
// before Expression<Map.Entry<String, Item>> e = orderItems.entry(); Predicate p = cb.isTrue(e.isNull()); // throws "Whatever JPA" // after Predicate p = cb.isNotNull(orderItems.value()); // compare VALUE()/KEY(), not ENTRY()
Defensive patterns
Strategy: type-guard
Type guard
static boolean predicateCapable(Expression<?> e) {
return !(e instanceof SqmMapEntryReference<?, ?>);
} Prevention
- Treat ENTRY(m) as select-only; never build predicates directly on it
- Express null-checks as cb.isNull(mapJoin.value()) / cb.isNotNull(mapJoin.key())
- In generic predicate wrappers, skip SqmMapEntryReference expressions
- Prefer KEY()/VALUE() navigation for all map filtering
When it happens
Trigger: Calling isNull() on the expression returned by HQL 'entry(m)' or criteria mapJoin.entry(), e.g. cb.isTrue(entryExpr.isNull()) or generic predicate wrappers that null-check arbitrary expressions.
Common situations: Generic query builders that apply null-checks to every expression; attempting to test whether a map entry exists; refactoring value()/key() predicates onto entry() by mistake.
Related errors
- Could not interpret attribute '%s' of basic-valued path '%s'
- Boolean expression does not support max()
- Boolean expression does not support min()
- Cte root does not have an entity type. Use getReferencedPath
- Embeddable paths cannot be TREAT-ed to an entity type
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/5537da227ea6c52c.
Report an issue: GitHub.