hibernate/hibernate-orm · error · MappingException
Could not instantiate persister
Error message
Could not instantiate persister %s (%s)
What it means
Wraps any unexpected reflective instantiation failure while creating a custom entity persister: constructor.newInstance failed for a reason other than a MappingException (e.g. an error inside the persister constructor or an access problem). The faulty input is the persister class resolved for entityBinding; inspect the cause chain to find the real failure in the persister implementation.
Solutions
- Verify the custom persister class has a constructor matching (EntityBinding, EntityMetamodel, PersistenceContext) and is public.
- Check the nested cause for the underlying instantiation failure.
- Ensure the persister class is on the classpath and loadable.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Hibernate bootstrap fails to create a configured custom implementation class.
Common situations: A custom persister/factory/resolver class is missing, non-public, or lacks the required constructor.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/7cd0fca7dadb7eef.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java:82
PersistentClass entityBinding,
EntityDataAccess entityCacheAccessStrategy,
NaturalIdDataAccess naturalIdCacheAccessStrategy,
RuntimeModelCreationContext creationContext) {
final var persisterClass = persisterClassResolver.getEntityPersisterClass( entityBinding );
final var constructor = resolveEntityPersisterConstructor( persisterClass );
try {
return constructor.newInstance( entityBinding, entityCacheAccessStrategy, naturalIdCacheAccessStrategy, creationContext );
}
catch (MappingException e) {
throw e;
}
catch (InvocationTargetException e) {
final var target = e.getTargetException();
if ( target instanceof HibernateException hibernateException ) {
throw hibernateException;
}
else {
throw new MappingException(
String.format(
Locale.ROOT,
"Could not instantiate persister %s (%s)",
persisterClass.getName(),
entityBinding.getEntityName()
),
target
);
}
}
catch (Exception e) {
throw new MappingException(
String.format(
Locale.ROOT,
"Could not instantiate persister %s (%s)",
persisterClass.getName(),
entityBinding.getEntityName()
),View on GitHub (pinned to fad1729dce)