Closed edwardotis closed 7 years ago
Hi.
There's a warning on the documentation about this: https://github.com/kaleidos/grails-postgresql-extensions#configuration. Obviously it's not enough, sorry about that. I'm planning to migrate all the documentation to asciidoctor, so once I do that the warnings and notes should be easy to find.
The problem is with Hibernate 5.1. They have changed the way the sequence name is generated, so I'm afraid we can't do anything about it. Those changes are included in version 5.0.0
so if you're using 4.6.8
(that supports Hibernate 4 but not 5) the behavior should be the previous one.
Hi,
Actually, I read the part about hibernate 5. I realize I did not give enough info on my hibernate config. I'm still using hibernate 4 for both versions, though the library versions have been updated.
Old: grails 2.5.5 liquibase database-migration:1.4.1 org.postgresql:postgresql:9.4.1207 postgresql-extensions:4.6.1 hibernate4:4.3.10 org.jadira.usertype:usertype.core:4.0.0.GA Postgres 9.5 Java 8 Ubuntu 14.04LTS
New grails 3.1.14 runtime 'org.grails.plugins:database-migration:2.0.0' compile 'org.liquibase:liquibase-core:3.5.3 org.postgresql:postgresql:9.4.1212 postgresql-extensions:4.6.8 compile "org.grails.plugins:hibernate4:5.0.12" compile "org.hibernate:hibernate-core:4.3.11.Final" compile "org.hibernate:hibernate-ehcache:4.3.11.Final", { exclude module: 'ehcache-core' } compile("org.jadira.usertype:usertype.core:4.0.0.GA") { exclude group: 'org.hibernate', module: 'hibernate-entitymanager' } //BEGIN spring-security-ui depends on explicit hibernate4:5.0.x compile 'org.grails:grails-datastore-core:5.0.12.RELEASE' compile 'org.grails:grails-datastore-gorm-support:5.0.12.RELEASE' compile 'org.grails:grails-datastore-gorm:5.0.12.RELEASE' compile 'org.grails:grails-datastore-simple:5.0.12.RELEASE' compile 'org.grails:grails-datastore-gorm-hibernate4:5.0.12.RELEASE' compile 'org.grails:grails-datastore-gorm-hibernate-core:5.0.12.RELEASE' Postgres 9.5 Java 8 Ubuntu 14.04LTS
Could you please create a sample project with Grails 3.1.14 that reproduces the issue? The version 4.6.8
it's not compatible with Hibernate 5 and the sequence changes has not been applied:
@ilopmar Thanks for finding that diff. Upon further investigation, this is almost certainly due to a bug in liquibase that is improperly re-generating changesets on existing schemas. I see that the initial generation of the sequence name uses proper hibernate4 pattern. The needless re-generation of the sequence uses the wrong pattern. So, everything looks fine with the grails-postgresql-extensions plugin. Thanks for your help.
For reference:
Thank you!
The default sequence name pattern has changed from grails 2 to 3, and this breaks the database migration plugin diffs. I have to manage the name by hand for each Domain class now.
Is there a way to set the default sequence naming pattern in Grails 3.x back to the 2.x style, so I don't have to manage this individually on each Domain class?
Thanks
-- Grails 2.x Hibernate 4 org.postgresql:postgresql:9.4.1207 postgresql-extensions:4.6.1
grails.gorm.default.mapping = { id generator: 'native' }
Results in: seq_
Grails 3.x Hibernate 4 org.postgresql:postgresql:9.4.1212 postgresql-extensions:4.6.8 grails.gorm.default.mapping = { id generator: 'native' }
Results in: