Hibernate version:
3.2.1GA
Name and version of the database you are using:
Postgres 8.1.4
Hi,
We're having a problem using LockMode.UPGRADE. The situation is as follows:
We persist an Object with an id in a TX
Then we start 2 TX's in seperate Threads (to simulate parallel processing), in both TX's we first try to get the Object with LockMode.UPGRADE with the same id as above, remove this object and then insert it again. (The remove uses flush() and clear())
What we expect is that TX1 performs these actions and TX2 will be suspended untill TX1 is done. TX2 will then get the lock on the Object inserted during TX1 and then performs the same actions.
What we see is that TX2 is suspended during TX1 but TX2 cannot find the Object anymore based on the id after TX1 is done. This is not what we want but are unsure of what is exectly happening. For TX we use PROPAGATION_REQUIRES_NEW to make sure there are 2 seperate TX's. We've tried different isolationlevels but no luck.
Hope someone can point us in the right direction or has an anwser.
Thanks,
Maarten
|