You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hibernate 7: the default native id generator never creates its sequences on PostgreSQL #16561
With grails-data-hibernate7 8.0.0, PostgreSQL and dbCreate: create-drop, domain classes with the default id
mapping get their sequences created and can be saved, as with Hibernate 5.
Actual Behaviour
No create sequence statement is executed, and every save fails with:
org.hibernate.HibernateException: Identifier generator (SequenceStyleGenerator) was not properly initialized.
This usually happens if table creation failed (check previous logs for DDL errors).
There are no DDL errors. The tables are created; only the sequences are missing.
GrailsNativeGenerator's constructor calls initialize(null, null, context) and ignores any exception it throws.
On PostgreSQL the NativeGenerator delegate is a SequenceStyleGenerator that is never configured, so its sequence is
never registered as an exportable. On H2 the native generator uses IDENTITY, which is probably why the tests don't
catch it.
Mapping ids with id generator: 'sequence' works, because GrailsSequenceStyleGenerator configures the generator
and registers its exportables itself.
Steps To Reproduce
A Grails 8.0.0 app with grails-data-hibernate7, a PostgreSQL datasource and dbCreate: create-drop
Activity
test: cover the default native id generator on every database RLikeHi…
fix: create the sequences of the default native id generator on seque…