when I use hsqldb with grails, it seems that each domain class gets its own counter for the id autoincrement. When I create an object of type a, it gets ID=1. When I then create an object of type b, it gets ID=1. When I then create an object of type a again, it gets ID=2.
That’s the behaviour I expect.
when I use an oracle db it seems that there is only one global counter for all IDs of all domain classes. When I create an object of type a, it gets ID=1. When I then create an object of type b, it gets ID=2. When I then create an object of type a again, it gets ID=3.
How can I change this?
Grails is using hibernate and by default hibernate is using only one sequence to generate all ids. If you need one sequence per table you can edit Config.groovy. Add following line: