We are having problems with table locking and deadlocks in EJB 3.0 / JPA 1.0 / DB2 10.1 application. We found out that if simple SELECT query is excecuted within ejb method that supports transaction, records are getting locked (next key share lock - NS lock mode), which eventually leads to potential problems with deadlocks. If same query is exeçuted within ejb method without transaction no locking occurs, which I think is the way it should be.
Question: we have ejb ejbA with methodA that requires transaction. We have ejbB with methodB which has simple select query, and should not run within transaction so we set trnasaction attribute to: NotSupported. We call methodB from methodA.
Oracle EE6 tutorial says: If the client is running within a transaction and invokes the enterprise bean’s method, the container suspends the client’s transaction before invoking the method. After the method has completed, the container resumes the client’s transaction.
As we understand methodB should suspend transaction from methodA and should not lock the record, but it does, which leads me to conclusion that transaction is not suspended.
Can you please help us resolve and understand the behavior.