{"record":{"id":"cb2e0d6e2d45b85b","repo":"hibernate/hibernate-orm","slug":"could-not-resolve-attribute-s-of-s-due-to-th","errorCode":null,"errorMessage":"Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes '%s' and '%s'","messagePattern":"Could not resolve attribute '(.+?)' of '(.+?)' due to the attribute being declared in multiple subtypes '(.+?)' and '(.+?)'","errorType":"exception","errorClass":"PathException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java","lineNumber":239,"sourceCode":"\t\t\t\treturn hasSingleIdAttribute() ? findIdAttribute() : getIdentifierDescriptor();\n\t\t\t}\n\t\t\telse if ( EntityDiscriminatorMapping.matchesRoleName( name ) ) {\n\t\t\t\treturn discriminatorPathSource;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate SqmPersistentAttribute<?, ?> findSubtypeAttribute(String name) {\n\t\tSqmPersistentAttribute<?,?> subtypeAttribute = null;\n\t\tfor ( var subtype : super.getSubTypes() ) {\n\t\t\tfinal var candidate = subtype.findSubTypesAttribute( name );\n\t\t\tif ( candidate != null ) {\n\t\t\t\tif ( subtypeAttribute != null\n\t\t\t\t\t\t&& !isCompatible( subtypeAttribute, candidate, metamodel.getMappingMetamodel() ) ) {\n\t\t\t\t\tthrow new PathException(\n\t\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\t\t\"Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes '%s' and '%s'\",\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tgetTypeName(),\n\t\t\t\t\t\t\t\t\tsubtypeAttribute.getDeclaringType().getTypeName(),\n\t\t\t\t\t\t\t\t\tcandidate.getDeclaringType().getTypeName()\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsubtypeAttribute = candidate;\n\t\t\t}\n\t\t}\n\t\treturn subtypeAttribute;\n\t}\n\n\t@Override\n\tpublic @Nullable SqmPersistentAttribute<? super J, ?> findAttribute(@Nonnull String name) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EntityTypeImpl.java#L221-L257","documentation":"Error \"Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes '%s' and '%s'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when an attribute name is ambiguous because it is declared in two different subtypes of the queried entity hierarchy.","commonSituations":"See trigger scenarios.","solutions":["Qualify the query path with a treat() to the specific subtype declaring the attribute.","Rename one of the conflicting subtype attributes to make the attribute unambiguous."],"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"}