I'm looking for a proper GenerationType that will work both on SQL Server and Oracle DB.
My table has a simple int ID, which has a IDENTITY behaviour in SQL Server. I would like Hibernate to leverage that IDENTITY when SQL Server is used.
I also need Hibernate to use Table or Sequence strategy if Oracle DB is used.
I thought that the correct type to use would be GenerationType.AUTO. However, if I use that type with SQL Server, Hibernate tries to query a sequence table in order to obtain the next ID.
If I use the IDENTITY type, Hibernate lets SQL Server use the column auto-increment behaviour, but IDENTITY is not supported by Oracle.
|