Uploaded image for project: 'Hibernate ORM'
  1. HHH-9169

SQLServer2012Dialect creates sequences starting from Long.MIN_VALUE

    Details

    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      CREATE SEQUENCE hibernate_sequence
      

      on MSSQL2012 creates a sequence of type bigint, starting by default from the number -9,223,372,036,854,775,808. It would make much more sense to start with 1, as other dialects do.

      Furthermore, this number is exactly equal to java's Long.MIN_VALUE, so it confuses the IdentifierGeneratorHelper$BasicHolder which then thinks it hasn't been initialized and throws IdentifierGenerationException from the makeValue() method. This means the default hibernate_sequence becomes unusable

      To reproduce, run org.hibernate.test.id.SequenceGeneratorTest against a SQL Server 2012 database. It will fail with

      org.hibernate.id.IdentifierGenerationException: integral holder was not initialized
      

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: