hibernate/hibernate-orm · error · MappingException
@GeneratedValue for ( ) specified TABLE generation, but…
Error message
@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @GenericGenerator
What it means
Cross-registration guard in validateTableGeneration: @GeneratedValue asked for TABLE strategy, but the generator name matches a global @GenericGenerator registration. The named generic generator cannot back TABLE generation.
Solutions
- Reference a @TableGenerator for TABLE generation instead of a @GenericGenerator.
Defensive patterns
Strategy: validation
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/3689d466066e188e.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdGeneratorResolverSecondPass.java:204
final var globalRegistrations = buildingContext.getMetadataCollector().getGlobalRegistrations();
final String generator = generatedValue.generator();
final var globalSequenceMatch = globalRegistrations.getSequenceGeneratorRegistrations().get( generator );
if ( globalSequenceMatch != null ) {
throw new MappingException(
String.format(
Locale.ROOT,
"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @SequenceGenerator",
entityMapping.getEntityName(),
generator
)
);
}
final var globalGenericMatch = globalRegistrations.getGenericGeneratorRegistrations().get( generator );
if ( globalGenericMatch != null ) {
throw new MappingException(
String.format(
Locale.ROOT,
"@GeneratedValue for %s (%s) specified TABLE generation, but referred to a @GenericGenerator",
entityMapping.getEntityName(),
generator
)
);
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// AUTO
private boolean handleAsUuid(ClassDetailsRegistry classDetailsRegistry) {
final var idMemberType = idMember.getType();
if ( idMemberType.isImplementor( UUID.class ) || idMemberType.isImplementor( String.class ) ) {
GeneratorAnnotationHelper.handleUuidStrategy(View on GitHub (pinned to fad1729dce)