Saturday 3 March 2012

Developer Diary - Hibernate Generated Primary Key Values

From 16th August 2011.

Ever since I started using Hibernate, I have noticed some weird behaviour with the primary keys that were being generated. They were way too high and being incremented strange multiples.

This bugged me personally, it wasn't causing any sort of bug in the code but I was determined to get to the root cause of the problem.

Turns out you have to tell Java Persistence not to multiple your sequence generator by 50! Why this default logic is in place, I don't know...

More details here ^_^ Spread the word!

No comments:

Post a Comment