hi! i try to lock an entire table with hibernate. I would obtain a max value from an attribute of a table, and so use this incremented value of one unit to insert a new row in this table. So the mistake is that i don't obtain the lock of the table and so if i launch two processes that execute this operation in the same time, the last process throws an exception because of the duplication of the primary key. The most important thing is that i can't set the primary key as an autoincrement key.
Thanks for all answers.
|