Title: RE: problems with batch-mode=true

Hi,

Here is the code that I tested. You can
see that setBatchMode is called before I start
the tx.
        try
        {
            broker.serviceConnectionManager().setBatchMode(true);
            broker.beginTransaction();

            for (int i = 0; i < 100; i++)
            {
                CustomerInterface customer = new Customer();
                customer.setCustomerNumber("100" + i);
                customer.setFirstName("Big");
                customer.setLastName("Customer");
                customer.setCustomerName("BadCorporation");
                customer.setDeleteTag(Boolean.FALSE);

                broker.store(customer);
            }

     //       conMan.executeBatch();
            broker.commitTransaction();
        }
        catch(Exception e)
        {
                e.printStackTrace();
                logger.error(e.getMessage());
                broker.abortTransaction();
        }
        finally
        {         
            broker.close();
        }
 
This chunk of code, exectued with batch-mode="true"
in repository_database.xml, results in the following
two exceptions :

java.lang.IllegalArgumentException: object is not an instance of declaring class
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecute(Unknown Source)
        at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(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(Unknown Source)
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.commitTransaction(Unknown Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.commitTransaction(Unknown Source)
        at com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigration.java:69)
3425  ERROR [main] dbmigrationutils.CustomerMigration - object is not an instance of declaring class
3435  DEBUG [main] core.PersistenceBrokerImpl - PB.close was called: [EMAIL PROTECTED]

org.apache.ojb.broker.TransactionNotInProgressException: ConnectionManager is NOT in transaction
        at org.apache.ojb.broker.core.PersistenceBrokerImpl.abortTransaction(Unknown Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown Source)
        at org.apache.ojb.broker.core.DelegatingPersistenceBroker.abortTransaction(Unknown Source)
        at com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigration.java:75)
Exception in thread "main"


It looks like the persistence broker is being closed down before the call to abortTransaction
is made. But that does not explain the first exception. This code works perfectly with
batch-mode="false".

And, if I call executeBatch, I don't get the second exception (the one about not being in
a transaction), although I still get the first transaction.

I am including  my repository_database.xml as an attachment. It is always possible that
I am doing something terribly wrong there. The relevant jcd-alias is "ActiveBillStandalone"

thanks,
Bonnie MacKellar
software engineer
Mobius Management Systems, Inc.
[EMAIL PROTECTED]



> -----Original Message-----
> From: Armin Waibel [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 21, 2003 5:37 PM
> To: OJB Users List
> Subject: Re: problems with batch-mode=true
>
>
> Hi,
>
> hmm, this should not happen.
>
> Please try to set
> broker.serviceConnectionManager.setBachMode(true);
> before start the tx. Because the connection was
> associated with PB instance on PB.beginTx, so setting
> batch-mode after this may cause problems.
>
> I currently made some tests against sapDB
> without any problems (using CVS head)
>
> regards,
> Armin
>
>

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to