hibernate/hibernate-orm · error · HibernateException
Unable to instantiate
Error message
Unable to instantiate
What it means
Error "Unable to instantiate " thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/id/uuid/UuidGenerator.java:149
);
}
return instantiateCustomGenerator( config.algorithm() );
}
return switch ( style ) {
case TIME -> new CustomVersionOneStrategy();
case VERSION_6 -> UuidVersion6Strategy.INSTANCE;
case VERSION_7 -> UuidVersion7Strategy.INSTANCE;
default -> StandardRandomStrategy.INSTANCE;
};
}
}
private static UuidValueGenerator instantiateCustomGenerator(Class<? extends UuidValueGenerator> algorithmClass) {
try {
return algorithmClass.getDeclaredConstructor().newInstance();
}
catch (Exception e) {
throw new HibernateException( "Unable to instantiate " + algorithmClass.getName(), e );
}
}
private ValueTransformer determineProperTransformer(Class<?> propertyType) {
if ( UUID.class.isAssignableFrom( propertyType ) ) {
return UUIDJavaType.PassThroughTransformer.INSTANCE;
}
else if ( String.class.isAssignableFrom( propertyType ) ) {
return UUIDJavaType.ToStringTransformer.INSTANCE;
}
else if ( byte[].class.isAssignableFrom( propertyType ) ) {
return UUIDJavaType.ToBytesTransformer.INSTANCE;
}
else {
throw new HibernateException( "Unanticipated return type [" + propertyType.getName() + "] for UUID conversion" );
}
}
}View on GitHub (pinned to fad1729dce)
Solutions
- Ensure the custom UUID value generator class has a public no-arg constructor and is on the classpath.
When it happens
Trigger: Thrown when Hibernate fails to instantiate a configured class (reflection failure).
Common situations: Typical situations: the class is not on the classpath; no accessible no-arg constructor; the configured class name is misspelled.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/028c710f9982ba9e.
Report an issue: GitHub.