[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6881) identity strategy AUTO uses SequenceStyleGenerator on mssql

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Dec 30 20:33:21 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44792#comment-44792 ] 

Steve Ebersole commented on HHH-6881:
-------------------------------------

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.

> 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