mango wrote:
I can create a sequence in the database, but I have given the id generator as native, so that I can decouple my code from db specific.
So I am wondering, what would be the solution for this problem?
Thanks,
Sri
What makes you think there is a problem? If you check the Hibernate reference document, section 5.1.4.1, it states:
Code:
native
picks identity, sequence or hilo depending upon the capabilities of the underlying database.
Since Oracle doesn't have identity columns (at least, it didn't the last time I looked), then Hibernate must choose one of the latter two options. Looking at the source code, it appears that the Dialect code checks the options in the same order as the documentation -- identity, sequence, and then hilo. So, when using Oracle, Hibernate is going to use a sequence.
If you move your code to another database engine that does support identity columns, it will use those.