We're updating the issue view to help you get more done. 

SQLServer2012Dialect creates sequences starting from Long.MIN_VALUE

Description

1 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

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

Environment

None

Status

Assignee

Gail Badner

Reporter

Jan Martiška

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

4.2.12

Priority

Major