crista wrote:
Hi everybody,
I have found into Hibernate in Action book (page 91) the following explanation:
At Hibernate startup, this generator reads the maximum primary key column value of the table and increments the value by one each time a new row is inserted.
The generated identifier is of type long, short, or int.
This generator is especially efficient if the single-server Hibernate application has exclusive access to the database but shouldn’t be used in any other scenario.
Now everything is clear regarding this subject.
See you soon, Cristian.
Right, the "highest value" is held somewhere within the JVM, with a lock around it. If some other JVM (or anything else) had write access to that table it wouldn't work.