Hello,
Till recently I've been using successfully the org.hibernate.id.enhanced.TableGenerator id generator, but now I came across an interesting problem:
I have a table that both hibernate and non-hibernate processes access and insert new rows into, possibly simultaneously.
Therefore I no longer can use the sequence approach, as the non-hibernate process is not aware of the sequence-like table used by hibernate, and does not increment the appropriate value.
Neither can I use the increment generator, as it is not protected against simultaneous access.
The hi/lo generator is as well unsuitable, if I understand correctly, as the non-hibernate process will not use it, therefore the generator might return already used value.
Therefore, the only solution that I see is to implement my own indicator, or have I missed anything?
Any help is highly appreciated,
Vitaliy
|