{"record":{"id":"66ca63755d124412","repo":"hibernate/hibernate-orm","slug":"entity-mapping-does-not-support-primary-tablerefer","errorCode":null,"errorMessage":"Entity mapping does not support primary TableReference creation [{className} : {entityName}]","messagePattern":"Entity mapping does not support primary TableReference creation \\[(.+?) : (.+?)\\]","errorType":"exception","errorClass":"UnsupportedMappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java","lineNumber":612,"sourceCode":"\t\t\tNavigablePath navigablePath,\n\t\t\tString explicitSourceAlias,\n\t\t\tSqlAliasBase explicitSqlAliasBase,\n\t\t\tSupplier<Consumer<Predicate>> additionalPredicateCollectorAccess,\n\t\t\tSqlAstCreationState creationState) {\n\t\treturn getEntityPersister().createRootTableGroup(\n\t\t\t\tcanUseInnerJoins,\n\t\t\t\tnavigablePath,\n\t\t\t\texplicitSourceAlias,\n\t\t\t\texplicitSqlAliasBase,\n\t\t\t\tadditionalPredicateCollectorAccess,\n\t\t\t\tcreationState\n\t\t);\n\t}\n\n\tdefault TableReference createPrimaryTableReference(\n\t\t\tSqlAliasBase sqlAliasBase,\n\t\t\tSqlAstCreationState creationState) {\n\t\tthrow new UnsupportedMappingException(\n\t\t\t\t\"Entity mapping does not support primary TableReference creation [\" +\n\t\t\t\t\t\tgetClass().getName() + \" : \" + getEntityName() + \"]\"\n\t\t);\n\t}\n\n\tdefault TableReferenceJoin createTableReferenceJoin(\n\t\t\tString joinTableExpression,\n\t\t\tSqlAliasBase sqlAliasBase,\n\t\t\tTableReference lhs,\n\t\t\tSqlAstCreationState creationState) {\n\t\tthrow new UnsupportedMappingException(\n\t\t\t\t\"Entity mapping does not support primary TableReference join creation [\" +\n\t\t\t\t\t\tgetClass().getName() + \" : \" + getEntityName() + \"]\"\n\t\t);\n\t}\n\n\t@Override\n\tdefault JavaType<?> getMappedJavaType() {","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java#L594-L630","documentation":"Error \"Entity mapping does not support primary TableReference creation [{className} : {entityName}]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when SQL generation requests a primary table reference from an entity mapping type that does not support it (e.g. a non-persister mapping).","commonSituations":"See trigger scenarios.","solutions":["This is an internal limitation; report it with a reproducer or avoid the query shape (e.g. treat or path) that triggers primary table reference creation on this mapping."],"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"}