hibernate/hibernate-orm · error · HibernateException
Could not determine primary table name for entity: <classNam
Error message
Could not determine primary table name for entity: <className>
What it means
Error "Could not determine primary table name for entity: <className>" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/naming/ImplicitNamingStrategyJpaCompliantImpl.java:38
* preferring to conform to JPA standards.
* <p>
* For the legacy JPA-based naming standards initially implemented by Hibernate,
* see/use {@link ImplicitNamingStrategyLegacyJpaImpl}.
*
* @author Steve Ebersole
*/
public class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStrategy, Serializable {
public static final ImplicitNamingStrategy INSTANCE = new ImplicitNamingStrategyJpaCompliantImpl();
public ImplicitNamingStrategyJpaCompliantImpl() {
}
@Override
public Identifier determinePrimaryTableName(ImplicitEntityNameSource source) {
assert source != null;
final String tableName = transformEntityName( source.getEntityNaming() );
if ( tableName == null ) {
throw new HibernateException( "Could not determine primary table name for entity: "
+ source.getEntityNaming().getClassName() );
}
return toIdentifier( tableName, source.getBuildingContext() );
}
protected String transformEntityName(EntityNaming entityNaming) {
return isNotEmpty( entityNaming.getJpaEntityName() )
// prefer the JPA entity name, if specified
? entityNaming.getJpaEntityName()
// otherwise, use the unqualified Hibernate entity name
: unqualify( entityNaming.getEntityName() );
}
/**
* JPA states we should use the following as default:
* <blockquote>The concatenated names of the two associated primary entity
* tables (owning side first), separated by an underscore.</blockquote>View on GitHub (pinned to fad1729dce)
Solutions
- Give the entity an explicit table name via @Table(name=...) or supply a custom ImplicitNamingStrategy that returns a table name.
Example fix
Give the entity an explicit table name via @Table(name=...) or supply a custom ImplicitNamingStrategy that returns a table name.
When it happens
Trigger: An entity mapping annotation or bootstrap configuration violates a Hibernate mapping rule.
Common situations: Annotation mapping mistakes: inverse-side @Id associations, @Column on @OneToOne, unmapped association targets, mismatched @EnumeratedValue/@Temporal usage, duplicate sequence generators.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/e919f65464f07708.
Report an issue: GitHub.