satish
January 22, 2018, 11:14am
1
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.
Regards
Satish
vlad
January 22, 2018, 11:29am
2
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 .
satish
January 22, 2018, 11:49am
3
Thank you for the swift response.
Can you please give me some example to do this scenario.
Regards
Satish
vlad
January 22, 2018, 12:13pm
4
Assuming you have a my_sequence
sequence, this is how your mapping should look like:
@Id
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "sequence-generator"
)
@SequenceGenerator(
name = "sequence-generator",
sequenceName = "my_sequence"
)
private Long id;
For more details, check out this article .
fyi just upgraded to hibernate 6 and I’m getting this message. I probably broke some sequence-related annotations and it’s my bad, but this clearly exist somewhere.
IIUC. this will happen if you have sequence defined with min-value, start-value equal to Integer.MIN_VALUE which is abused to have meaning of ‘undefined’ sequence value.
Here:
org.hibernate.id.IdentifierGeneratorHelper.BasicHolder#checkInitialized