{"record":{"id":"5537da227ea6c52c","repo":"hibernate/hibernate-orm","slug":"whatever-jpa","errorCode":null,"errorMessage":"Whatever JPA","messagePattern":"Whatever JPA","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/domain/SqmMapEntryReference.java","lineNumber":193,"sourceCode":"\t\t\t&& mapPath.isCompatible( that.mapPath )\n\t\t\t&& Objects.equals( explicitAlias, that.explicitAlias );\n\t}\n\n\t@Override\n\tpublic int cacheHashCode() {\n\t\tint result = mapPath.cacheHashCode();\n\t\tresult = 31 * result + Objects.hashCode( explicitAlias );\n\t\treturn result;\n\t}\n\n\n\t// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\t// JPA (ugh)\n\n\t@Nonnull\n\t@Override\n\tpublic Predicate isNull() {\n\t\tthrow new UnsupportedOperationException( \"Whatever JPA\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic Predicate isNotNull() {\n\t\tthrow new UnsupportedOperationException( \"Whatever JPA\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic Predicate equalTo(@Nonnull Expression<?> value) {\n\t\tthrow new UnsupportedOperationException( \"Whatever JPA\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic Predicate equalTo(Object value) {\n\t\tthrow new UnsupportedOperationException( \"Whatever JPA\" );","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/domain/SqmMapEntryReference.java#L175-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nExpression<Map.Entry<String, Item>> e = orderItems.entry();\nPredicate p = cb.isTrue(e.isNull()); // throws \"Whatever JPA\"\n\n// after\nPredicate p = cb.isNotNull(orderItems.value()); // compare VALUE()/KEY(), not ENTRY()","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"static boolean predicateCapable(Expression<?> e) {\n    return !(e instanceof SqmMapEntryReference<?, ?>);\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["hibernate","criteria-api","hql","map-entry","entry-function","sqm"],"backgroundTag":"map-entry-unsupported-comparison","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}