{"record":{"id":"e919f65464f07708","repo":"hibernate/hibernate-orm","slug":"could-not-determine-primary-table-name-for-entity","errorCode":null,"errorMessage":"Could not determine primary table name for entity: <className>","messagePattern":"Could not determine primary table name for entity: <className>","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/naming/ImplicitNamingStrategyJpaCompliantImpl.java","lineNumber":38,"sourceCode":" * preferring to conform to JPA standards.\n * <p>\n * For the legacy JPA-based naming standards initially implemented by Hibernate,\n * see/use {@link ImplicitNamingStrategyLegacyJpaImpl}.\n *\n * @author Steve Ebersole\n */\npublic class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStrategy, Serializable {\n\tpublic static final ImplicitNamingStrategy INSTANCE = new ImplicitNamingStrategyJpaCompliantImpl();\n\n\tpublic ImplicitNamingStrategyJpaCompliantImpl() {\n\t}\n\n\t@Override\n\tpublic Identifier determinePrimaryTableName(ImplicitEntityNameSource source) {\n\t\tassert source != null;\n\t\tfinal String tableName = transformEntityName( source.getEntityNaming() );\n\t\tif ( tableName == null ) {\n\t\t\tthrow new HibernateException( \"Could not determine primary table name for entity: \"\n\t\t\t\t\t\t\t\t\t\t\t+ source.getEntityNaming().getClassName() );\n\t\t}\n\t\treturn toIdentifier( tableName, source.getBuildingContext() );\n\t}\n\n\tprotected String transformEntityName(EntityNaming entityNaming) {\n\t\treturn isNotEmpty( entityNaming.getJpaEntityName() )\n\t\t\t\t// prefer the JPA entity name, if specified\n\t\t\t\t? entityNaming.getJpaEntityName()\n\t\t\t\t// otherwise, use the unqualified Hibernate entity name\n\t\t\t\t: unqualify( entityNaming.getEntityName() );\n\t}\n\n\n\t/**\n\t * JPA states we should use the following as default:\n\t * <blockquote>The concatenated names of the two associated primary entity\n\t * tables (owning side first), separated by an underscore.</blockquote>","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/naming/ImplicitNamingStrategyJpaCompliantImpl.java#L20-L56","documentation":"Error \"Could not determine primary table name for entity: <className>\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An entity mapping annotation or bootstrap configuration violates a Hibernate mapping rule.","commonSituations":"Annotation mapping mistakes: inverse-side @Id associations, @Column on @OneToOne, unmapped association targets, mismatched @EnumeratedValue/@Temporal usage, duplicate sequence generators.","solutions":["Give the entity an explicit table name via @Table(name=...) or supply a custom ImplicitNamingStrategy that returns a table name."],"exampleFix":"Give the entity an explicit table name via @Table(name=...) or supply a custom ImplicitNamingStrategy that returns a table name.","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"}