Hi together,

i'm using openjpa 2.0.1 and for connection pooling dbcp 1.4 in a non j2ee -
environment. 

My batch-application has to do many single selects by using the
entityManager method find. 
For example : 

em.getTransaction().begin(); 
...
for (int i = 1; i <= 200000; ++i) { 
    MitteilungsauftragEKAPK pka = new MitteilungsauftragEKAPK(); 
    pka.setStapelNr(stapel.getStapelNr()); 
    pka.setAuftragsNr(i); 
    MitteilungsauftragEKA auftrag = em.find(MitteilungsauftragEKA.class,
pka); 
} 
...
em.getTransaction().commit(); 

In this case it seems, that openjpa does a (auto)commit after ever single
select which results in a bad performace. When I modify another object
within the started transaction and call entityManager.flush() ist works fine
and the performance ist much better. In this case openjpa only does a commit
at the end of the started transaction. 

My question is : how can ich force openjpa to do no autocommit. 

I've tried to set the Connection-property DefaultAutoCommit to false in the
persistence.xml file without any success:

<property name="openjpa.ConnectionDriverName"
value="org.apache.commons.dbcp.BasicDataSource"/> 
<property name="openjpa.ConnectionProperties" 
value="DriverClassName=com.ibm.db2.jcc.DB2Driver, 
Url=zzz, 
Username=xxx, 
Password=yyy, 
InitialSize=1, 
MaxActive=5, 
MaxIdle=-1, 
DefaultAutoCommit=false, 
PoolPreparedStatements=true, 
ConnectionRetainMode=always, 
MaxOpenPreparedStatements=50" /> 
 
Thanks
csff
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/setting-autocommit-to-false-tp5765839p5765839.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to