{"record":{"id":"dce53d56ef7986ec","repo":"hibernate/hibernate-orm","slug":"joining-on-basic-value-elements-is-not-supported","errorCode":null,"errorMessage":"Joining on basic value elements is not supported","messagePattern":"Joining on basic value elements is not supported","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java","lineNumber":221,"sourceCode":"\t\t\t\t\t\t// and must not have a join condition.\n\t\t\t\t\t\t&& sqmJoin.getJoinPredicate() == null ) {\n\t\t\t\t\t\t// We explicitly allow reusing implicit joins of any type\n\t\t\t\t\t\treturn sqmJoin;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( fetch ) {\n\t\t\t\tfinal var compatibleFetchJoin = findCompatibleFetchJoin( lhs, subPathSource, joinType );\n\t\t\t\tif ( compatibleFetchJoin != null ) {\n\t\t\t\t\tif ( alias != null ) {\n\t\t\t\t\t\tthrow new IllegalStateException( \"Cannot fetch the same association twice with a different alias\" );\n\t\t\t\t\t}\n\t\t\t\t\treturn compatibleFetchJoin;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ( !(subPathSource instanceof SqmJoinable) ) {\n\t\t\tthrow new SemanticException( \"Joining on basic value elements is not supported\",\n\t\t\t\t\t((SemanticQueryBuilder<?>) creationState).getQuery() );\n\t\t}\n\t\t@SuppressWarnings(\"unchecked\")\n\t\tfinal var joinSource = (SqmJoinable<U, ?>) subPathSource;\n\t\treturn createJoin( lhs, joinType, alias, fetch, isTerminal, allowReuse, creationState, joinSource );\n\t}\n\n\tprivate static <U,V> SqmFrom<?, ?> createJoin(\n\t\t\tSqmFrom<?,U> lhs,\n\t\t\tSqmJoinType joinType,\n\t\t\tString alias,\n\t\t\tboolean fetch,\n\t\t\tboolean isTerminal,\n\t\t\tboolean allowReuse,\n\t\t\tSqmCreationState creationState,\n\t\t\tSqmJoinable<U,V> joinSource) {\n\t\tfinal var join = joinSource.createSqmJoin(\n\t\t\t\tlhs,","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/QualifiedJoinPathConsumer.java#L203-L239","documentation":"Error \"Joining on basic value elements is not supported\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An API operation is invoked on an object that does not support it.","commonSituations":"Using query/procedure/proxy APIs beyond their supported feature set (e.g. scrolling, locking, unwrapping a procedure call).","solutions":["Join only entity associations or embeddables, not basic-valued collection elements.","Restructure the query to join the element's entity if applicable."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}