I recently switched from Hibernate 3.6.4 to Hibernate 5.0.0 Final. I have an entity with an ID annotated in this way:
@Id
@GeneratedValue(generator="SEQ_MENUITEM")
@SequenceGenerator(name="SEQ_MENUITEM",sequenceName="SEQ_MENUITEM", allocationSize=1)
@Column(name = "ID_MENUITEM")
private int id;
the hibernate configuration can be either:
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
or
<property name="hibernate.dialect">org.hibernate.dialect.SQLServer2008Dialect</property>
based on the production environment, software has to be portable either in Oracle or Sql Server 2008.
Using Hibernate 3.6.4 it automatically switches from sequence to identity (autoincrement) when SQLServer2008Dialect is specified, so it works fine.
Using Hibernate 5 I have this error:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'SEQ_MENUITEM'.
He's looking for the sequence instead of switching to identity. My development environment is Sql Server 2014 (that supports sequences) but still my dialect is 2008 and production environment will be 2008.
Any idea? Is something changed from 3.6.4 to 5? I can't find any info or any further xml configuration (without changing all annotations in all entities while switching from oracle to sql server, of course).
Thank you.