Hi,
I have a question about the hibernate locking mechanism.
I am using Hibernate 3.2.6, Atomikos XA transaction manager and Oracle 9g.
I have 3 threads of type A which performs lock operation 4 times per second:
Code:
session.lock(object, LockMode.UPGRADE_NO_WAIT);
This threads analyzes and modifies records in the database if the acquire the lock - otherwise they skip the execution.
I have another 5 threads of type B which performs operation in an asynchronous onMessage method (JMS message receiver)
Code:
session.lock(object, LockMode.UPGRADE); .
They wait for the lock - then performs update, and then commits the transaction.
Is it possible that threads of type A will cause a deadlocks in threads of type B?
I am asking whether the locks are granted in the order of session.lock method invocation?
Or maybe it is not deterministic.
I sometimes get transaction timeout (300 seconds) in threads of type B - so my assumption is that the lock ordering is not deterministic? Is that right?
Regards,
Tom