[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6881) identity strategy AUTO uses SequenceStyleGenerator on mssql
andreas bleicher (JIRA)
noreply at atlassian.com
Mon Jan 2 07:46:20 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44817#comment-44817 ]
andreas bleicher commented on HHH-6881:
---------------------------------------
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
> identity strategy AUTO uses SequenceStyleGenerator on mssql
> -----------------------------------------------------------
>
> Key: HHH-6881
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6881
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 4.0.0.CR2
> Environment: Hibernate 4.0.0.CR2, JBoss 7.0.2, MSSQL2008, JTDS-1.2.5
> Reporter: andreas bleicher
> Priority: Blocker
>
> we are using identity generation with default strategy (GenerationType.AUTO) to support different DBMS (mssql, oracle, mysql)
> our Id annotations:
> {Code}
> @Id
> @GeneratedValue
> public long getId()
> {
> return id;
> }
> {Code}
> 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:
> {Code}
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> public long getId()
> {
> return id;
> }
> {Code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list