Closed GoogleCodeExporter closed 9 years ago
This is most likely a problem with how you have configured Hibernate to
generate unique keys.
You should start by asking questions on the hibernate mailing list.
Original comment by noelgrandin
on 4 Mar 2013 at 5:59
In the meantime I've discovered the problem: I've used @NaturalId(mutable =
true) annotation in the Hibernate mapping and started inserting records.
However, instead of inserting the correct natural IDs in one SQL, Hibernate 4
somehow decides to insert the record first with the default values then run a
bunch of updates to update the natural ID columns. Obviously, in case of more
than one records this yields the unique constraint violation.
Unfortunately, there's no way to tell Hibernate to stop doing that nor there's
a way to instruct H2 to defer the checking of unique constraints at the end of
the transaction.
Closing the issue as it's indeed not an H2 bug. Sorry for the inconveniences!
Original comment by krisztia...@gmail.com
on 4 Mar 2013 at 7:47
Original comment by noelgrandin
on 6 Mar 2013 at 5:05
Original issue reported on code.google.com by
krisztia...@gmail.com
on 27 Feb 2013 at 10:02