{"record":{"id":"a542e16b2f111509","repo":"hibernate/hibernate-orm","slug":"unsupported-path-source-domaintype","errorCode":null,"errorMessage":"Unsupported path source: ${domainType}","messagePattern":"Unsupported path source: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleSqmPathSource.java","lineNumber":97,"sourceCode":"\t\t}\n\t\telse if ( domainType instanceof EmbeddableDomainType<?> ) {\n\t\t\treturn new SqmEmbeddedValuedSimplePath<>(\n\t\t\t\t\tPathHelper.append( lhs, this, intermediatePathSource ),\n\t\t\t\t\tthis,\n\t\t\t\t\tlhs,\n\t\t\t\t\tlhs.nodeBuilder()\n\t\t\t);\n\t\t}\n\t\telse if ( domainType instanceof EntityDomainType<?> ) {\n\t\t\treturn new SqmEntityValuedSimplePath<>(\n\t\t\t\t\tPathHelper.append( lhs, this, intermediatePathSource ),\n\t\t\t\t\tthis,\n\t\t\t\t\tlhs,\n\t\t\t\t\tlhs.nodeBuilder()\n\t\t\t);\n\t\t}\n\n\t\tthrow new UnsupportedOperationException( \"Unsupported path source: \" + domainType );\n\t}\n}\n","sourceCodeStart":79,"sourceCodeEnd":100,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sqm/tuple/internal/AnonymousTupleSqmPathSource.java#L79-L100","documentation":"AnonymousTupleSqmPathSource.createSqmPath builds a concrete path for exactly three domain type kinds: basic (BasicDomainType), embeddable (EmbeddableDomainType) and entity (EntityDomainType). If the referenced attribute's type is anything else — most commonly a MappedSuperclass type, an 'any' mappings type, or another synthetic SqmExpressible — path creation has no implementation and throws UnsupportedOperationException 'Unsupported path source: <type>'. This surfaces when query code tries to keep navigating (get(...)) through a tuple attribute that is not navigable.","triggerScenarios":"Navigating further through a tuple-typed attribute, e.g. cteRoot.get(\"owner\") where 'owner' resolves to a mapped-superclass or other non-basic/embeddable/entity type, then calling .get(...) on the result; generic path walkers that unconditionally call createSqmPath/findSubPathSource chains.","commonSituations":"CTE/tuple queries whose attributes are typed by abstract hierarchy roots (@MappedSuperclass); polymorphic reference attributes; generic criteria-tree rewriters (count-query generators, DTO projectors) that dereference every path.","solutions":["Restrict navigation to attributes whose type is basic, embeddable or entity; treat basic attributes as leaf values (read them, don't navigate them)","Type the tuple/CTE attribute by a concrete @Entity or embeddable instead of a mapped superclass or polymorphic type","In generic walkers, check the domain type kind before creating sub-paths and skip/stop at unsupported kinds"],"exampleFix":"// before\nJpaCteCriteria<?> cte = query.with(\"data\", ...);\nSqmPath<?> owner = cteRoot.get(\"owner\"); // owner typed as a @MappedSuperclass\nSqmPath<?> name = owner.get(\"name\"); // UnsupportedOperationException: Unsupported path source\n\n// after — type the CTE attribute by the concrete entity\ncb.select(cteRoot.get(\"owner\")); // concrete User type, navigation works","handlingStrategy":"type-guard","validationCode":"SqmPathSource<?> src = (SqmPathSource<?>) attribute;\nDomainType<?> t = src.getPathType();\nif (!(t instanceof BasicDomainType || t instanceof EmbeddableDomainType || t instanceof EntityDomainType)) { /* not navigable — stop or select its value directly */ }","typeGuard":"static boolean isNavigableTupleAttribute(SqmPathSource<?> src) {\n    DomainType<?> t = src.getPathType();\n    return t instanceof BasicDomainType || t instanceof EmbeddableDomainType || t instanceof EntityDomainType;\n}","tryCatchPattern":"try { sub = path.get(name); } catch (UnsupportedOperationException e) { if (e.getMessage().startsWith(\"Unsupported path source\")) { /* stop navigation; select attribute as leaf value */ } else throw e; }","preventionTips":["Treat basic-typed tuple attributes as leaves — never call get(...) on them","Type CTE/tuple attributes by concrete entities or embeddables, not mapped superclasses","In generic path walkers, check the domain type kind before each navigation step"],"tags":["hibernate","path-navigation","tuple","sqm","cte","mapped-superclass"],"backgroundTag":"unsupported-path-source-type","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}