Hello,
You can skip to the bottom to get to the crux of the matter if you like :) . . .
I have a scenario (that was described in an earlier thread) where I essentially am getting synchronization issues where the same insert can occur back to back, resulting in a ConstraintViolationException.
So from that, I've been going through different ways that this might be solved. The trivial one is to simply synchronize the method. It would be ideal to avoid this however, as this is a performance critical code section.
Next is to lock the database - this is not ideal for the same reasons however.
Finally, I've been looking into the idea of the "Insert Ignore" query. This seems to have promise for our scenario, as the only time that an insert would be called a second time is in the event of synchronization problems.
This leads to my question: Is there a way to configure hibernate to use insert ignore for its queries?
|