There is an easy way to set hibernate to use different primary key ids for each table with postgres?
I tried to use postgres dialect in DataSource:
dialect = org.hibernate.dialect.PostgreSQLDialect
or
dialect = net.sf.hibernate.dialect.PostgreSQLDialect
But it doesn’t work.
Thanks
The short answer is no, there isn’t a easy way to do this. However, I have found a solution that does work. Basically you need to implement a custom dialect. Here is an implementation (please note the original source of the implementation within the comments).
The above implementation is should be stored as
TableNameSequencePostgresDialect.javaundersrc/java/com/my/customwithin your Grails project.Next, update your
DataSource.groovyto use this new custom dialect.That’s pretty much about it. Not easy but it can be done.