Hi
My applicaton makes calls to a server which is clustered across 2 JVMs. The requests can go to either servers. I am using Spring with Hibernate for DB calls (for DB2 database). However, I have noticed that there no automatic locking mechanism from Hibernate across JVMs. I did implement locking mechanism through something like - query.setLockMode("myBo", LockMode.UPGRADE); But this does not seem to work across the JVMs.
Problem scenario:
First JVM selects the data for update (with LockMode.UPGRADE in place) from Table1. Before first JVM finishes update, second JVM also selects the data from Table1(which should not happen). First JVM finishes update successfully. But second JVM fails (Update is happening on the index key for Table1) with DuplicateKeyException.
Can somebody please suggest a solution for this?
Thanks Radhika
|