hibernate/hibernate-orm · error · MappingException
${className} does not implement 'Generator'
Error message
${className} does not implement 'Generator' What it means
Error "${className} does not implement 'Generator'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/GeneratorStrategies.java:111
return ForeignGenerator.class;
case "uuid":
case "uuid.hex":
return UUIDHexGenerator.class;
case "uuid2":
return UUIDGenerator.class;
case "select":
return SelectGenerator.class;
case "guid":
return GUIDGenerator.class;
}
final Class<? extends Generator> clazz =
idValue.getBuildingContext().getBootstrapContext()
.getClassLoaderService()
.classForName( strategy );
if ( !Generator.class.isAssignableFrom( clazz ) ) {
// in principle, this shouldn't happen, since @GenericGenerator
// constrains the type to subtypes of Generator
throw new MappingException( clazz.getName() + " does not implement 'Generator'" );
}
return clazz;
}
public static Class<? extends Generator> mapLegacyNamedGenerator(String strategy, Dialect dialect) {
if ( "native".equals(strategy) ) {
strategy = dialect.getNativeIdentifierGeneratorStrategy();
}
switch (strategy) {
case "assigned":
return org.hibernate.id.Assigned.class;
case "enhanced-sequence":
case "sequence":
return SequenceStyleGenerator.class;
case "enhanced-table":
case "table":
return org.hibernate.id.enhanced.TableGenerator.class;
case "identity":View on GitHub (pinned to fad1729dce)
Solutions
- Make the referenced class implement the Generator interface.
When it happens
Trigger: An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.
Common situations: @GeneratedValue pointing at a generator of the wrong kind (SEQUENCE vs TABLE), a missing named generator, too many generator annotations, or an unsupported generation strategy for @CollectionId.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/af68b8f2f624fee1.
Report an issue: GitHub.