identity strategy AUTO uses SequenceStyleGenerator on mssql
Description
Activity
Alps March 22, 2017 at 5:02 PM
And I am running the application in local environment. Eclipse.
Alps March 22, 2017 at 5:00 PM
Hi,
I am facing same issue while upgrading to hibernate version 5.0. It worked fine in version 4.3. I changed my setting hibernate.id.new_generator_mappings to false in configuration/hibernate.cfg.xml file but still I am getting the same error. Hibernate is still using SequenceStyleGenerator and looking for hibernate_sequence which does not exists. However in old version (3.6 and 4.3) SequenceStyle generator was used and I did not get any error.
Thanks for your help
andreas bleicher January 2, 2012 at 2:45 PM
thanks for clarification!
additional note: setting this to true in PU.xml does currently not work due to a bug in JB7. see:
http://community.jboss.org/message/643800
https://issues.jboss.org/browse/AS7-3146
original forum discussion as reference:
http://community.jboss.org/thread/170623
https://issues.jboss.org/browse/AS7-2460
Steve Ebersole December 31, 2011 at 3:32 AM
This is not a bug. JBoss 7 is setting hibernate.id.new_generator_mappings
to true which has the effect you are seeing. That can cause problems for existing applications. Set that setting value to false.
we are using identity generation with default strategy (GenerationType.AUTO) to support different DBMS (mssql, oracle, mysql)
our Id annotations:
since upgrading to jboss7/hibernate4 we get the following error on mssql when persisting a new entity:
14:33:10,373 ERROR [org.hibernate.id.enhanced.TableStructure] (http--127.0.0.1-8080-3) could not read a hi value: java.sql.SQLException:
invalid object name 'hibernate_sequence'.
the reason is that instead of the IdentityGenerator the SequenceStyleGenerator is used although we are using the correct MSSQLServerDialect and it returns supportsIdentityColumns() = true. The SequenceStyleGenerator tries to find the 'hibernate_sequence' table which does not exist
workaround for mssql by changing code to: