hibernate/hibernate-orm · error · MappingException
Could not find appropriate constructor for
Error message
Could not find appropriate constructor for %s
What it means
Thrown when resolving the constructor for a (possibly custom) entity persister class: persisterClass.getConstructor(ENTITY_PERSISTER_CONSTRUCTOR_ARGS) found no matching public constructor. The faulty input is the persister class selected via persisterClassResolver (or a custom @Persister), which does not expose the required (PersistentClass, EntityDataAccess, NaturalIdDataAccess, RuntimeModelCreationContext) constructor.
Solutions
- Provide a constructor on the persister class with the exact signature Hibernate expects (EntityBinding/PersistentClass, EntityMetamodel/Collection, PersistenceContext).
- Make the constructor public or at least accessible to the persister factory.
Defensive patterns
Strategy: validation
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/2a39c5307b79a5d7.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/persister/internal/PersisterFactoryImpl.java:111
catch (Exception e) {
throw new MappingException(
String.format(
Locale.ROOT,
"Could not instantiate persister %s (%s)",
persisterClass.getName(),
entityBinding.getEntityName()
),
e
);
}
}
private Constructor<? extends EntityPersister> resolveEntityPersisterConstructor(Class<? extends EntityPersister> persisterClass) {
try {
return persisterClass.getConstructor( ENTITY_PERSISTER_CONSTRUCTOR_ARGS );
}
catch (NoSuchMethodException noConstructorException) {
throw new MappingException( "Could not find appropriate constructor for " + persisterClass.getName(), noConstructorException );
}
}
@Override
public CollectionPersister createCollectionPersister(
Collection collectionBinding,
@Nullable CollectionDataAccess cacheAccessStrategy,
RuntimeModelCreationContext creationContext) {
final var persisterClass = persisterClassResolver.getCollectionPersisterClass( collectionBinding );
final var constructor = resolveCollectionPersisterConstructor( persisterClass );
try {
return constructor.newInstance( collectionBinding, cacheAccessStrategy, creationContext );
}
catch (MappingException e) {
throw e;
}
catch (InvocationTargetException e) {View on GitHub (pinned to fad1729dce)