You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Sargol <s_...@hotmail.com> on 2011/02/06 16:08:31 UTC

distributed transaction waiting for lock

Hello 
We have configured a distributed transaction in our application server and
we are using openjpa 1.2.1 and Glassfish application server. Although the
default behavior of transaction locking must be optimistic, 
it seems that pessimistic locking has been happened. 
It is found that Row Lock contention happens in a specific table. 
This is the exception :
java.sql.SQLException: ORA-02049: timeout: distributed transaction waiting
for lock
Is there any property which has to be set related to XA transactions
management for openjpa?
For your information, already all the following properties have been set.

1. <persistence-unit name="JPXA" transation-type="JTA"> 

2. <property name="openjpa.TransactionMode" value="managed"/> 

   You can try a plug-in string to lookup the TM in JNDI (the value is the
JNDI name of GlassFish TM as per Google search) 
3. <property name="openjpa.ManagedRuntime"     
            
value="jndi(TransactionManagerName=java:appserver/TransactionManager)"/> 


Following searching about this locking problem, we found that we should add
two more properties for openjpa as listed below.

<property name="openjpa.LockManager" value="version" />
<property name="openjpa.jdbc.TransactionIsolation" value="read-committed" />
 

but this time we have got another error:
org.apache.openjpa.persistence.PersistenceException: ORA-02089: COMMIT is
not allowed in a subordinate session.

Thanks for any help.

Regards,
Sargol
 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/distributed-transaction-waiting-for-lock-tp5997733p5997733.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: distributed transaction waiting for lock

Posted by hmmahboobi <hm...@gmail.com>.

Please check the following links that may help you solve the problem.

https://issues.apache.org/jira/browse/OPENJPA-1192
https://issues.apache.org/jira/browse/OPENJPA-381

First, if users use JPA "out of the box" in WebSphere, they might think that
they are getting optimistic locking by default -- but in fact they are not.
The reason is the default isolation level on a data source in Websphere is
REPEATABLE READ. This gives pessimistic, not optimistic locking. Optimistic
locking defines that locks are not held on data that is read by the
application
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/distributed-transaction-waiting-for-lock-tp5997733p6006828.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.