db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ruppert <m.rupp...@merit.de>
Subject [OJB] Issue #OJB141 - OJB can not handle bulk inserts within one transaction on OR...
Date Tue, 11 Mar 2003 13:23:22 GMT
You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/OJB141>

Type :        Defect
Issue Id :    OJB141
Reported by: Michael Ruppert
             MichaelRuppert - (m.ruppert@merit.de)

Details:

Platform: PC
Operating system: windows 2000
Summary: OJB can not handle bulk inserts within one transaction on ORACLE
Description: There is a thing with OJB I canĀ“t understand.
schnipp -----
 PersistenceBroker myBroker =
PersistenceBrokerFactory.defaultPersistenceBroker();
 private void processObjects(ArrayList anObjectList)
        {   int theSize = anObjectList.size();

                  for (int i = 0 ; i < theSize; i++) {
                       myBroker.beginTransaction();
                   myBroker.store(anObjectList.get(i));
                      myBroker.commitTransaction();
                  }

        System.out.println("Writer wrote: "+theSize+ " Objects");
        }

schnapp -----

works without problem. No exceptions , all objects in the database.
---
Writer wrote: 10 Objects
Writer wrote: 41 Objects
Writer wrote: 50 Objects
---
fine :-)

but when I try do write a bulk of objects within one transaction I get
an
exception:
schnipp -----
 private void processObjects(ArrayList anObjectList)
        {   int theSize = anObjectList.size();

                  myBroker.beginTransaction();  // <------------

                  for (int i = 0 ; i < theSize; i++) {
                      myBroker.store(anObjectList.get(i));
                  }

                  myBroker.commitTransaction();// <------------

        System.out.println("Writer wrote: "+theSize+ " Objects");
        }

[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] ERROR: Commit
on
underlying connection failed, try to rollback
java.lang.NullPointerException
java.sql.SQLException: java.lang.NullPointerException
        at
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doEx
ecute(Unknown
Source)
        at
org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invo
ke(Unknown
Source)
        at $Proxy0.doExecute(Unknown Source)
        at
org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown
Source)
        at
org.apache.ojb.broker.util.batch.BatchConnection.commit(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localCommit(Unkn
own
Source)
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.commitTransaction(U
nknown
Source)
        at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.commitTransac
tion(Unknown
Source)
        at
de.intersoft.dacapo.model.batchjobs.DBWriterThread.processObjects(DBWrit
erThread.java:91)
        at
de.intersoft.dacapo.model.batchjobs.DBWriterThread.run(DBWriterThread.ja
va:76)
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback
was called, do rollback on current connection
oracle.jdbc.driver.OracleConnection@7200b4
org.apache.ojb.broker.TransactionAbortedException
        at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localCommit(Unkn
own
Source)
        at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.commitTransaction(U
nknown
Source)
        at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.commitTransac
tion(Unknown
Source)
        at
de.intersoft.dacapo.model.batchjobs.DBWriterThread.processObjects(DBWrit
erThread.java:91)
        at
de.intersoft.dacapo.model.batchjobs.DBWriterThread.run(DBWriterThread.ja
va:76)
schnapp -----


Here are my OJB parameters:
<descriptor-repository version="1.0" isolation-level="read-uncommitted">

    <jdbc-connection-descriptor
                jcd-alias="default"
                default-connection="true"
                platform="Oracle"
        jdbc-level="2.0"
        driver="oracle.jdbc.driver.OracleDriver"
        protocol="jdbc"
        subprotocol="oracle"
        dbalias="thin:@192.168.90.15:1521:db"
        username="xxx"
        password="xxx"
        batch-mode="true"
        useAutoCommit="0"
        ignoreAutoCommitExceptions="true"
     >
        <connection-pool
            maxActive="21"
            validationQuery="" />
   </jdbc-connection-descriptor>


If I set
 batch-mode="false"
it works.

Michael Ruppert
Status: New
Priority: Undecided
Vote: Medium
Severity: Critical


Mime
View raw message