Using a SQL Server sequence with Hibernate

Hi Everyone,

I have created a sequence in Sqlserver 2012, when I’m using this sequence in hibernate application I’m getting the below error.

IdentifierGenerationException:integral holder was not intialized

Please help me to resolve the issue.


I assume you are using a very old Hibernate version since I can’t even find that log message in Hibernate 5.3.

I that’s the case, you should probably upgrade to either
4.2.13 or 4.3.6 since they have the fix for HHH-9169.

Thank you for the swift response.
Can you please give me some example to do this scenario.


Assuming you have a my_sequence sequence, this is how your mapping should look like:

	strategy = GenerationType.SEQUENCE,
	generator = "sequence-generator"
	name = "sequence-generator",
	sequenceName = "my_sequence"
private Long id;

For more details, check out this article.