I tried your suggestions, but still get the error.
And if I remove the executeBatch call, I also get a
ConnectionManager is not in Transaction exception
when the transaction is committed.

Is there a way to find out what changes might have
been made? Have there been bug reports?

I copied my original code from 
org.apache.ojb.broker.BatchModeTest, by the
way, which is where I got the executeBatch call.
This is what is shown in that code.

And the javadoc definitely implies that
you can set the batch mode at runtime.

thanks,


> -----Original Message-----
> From: Armin Waibel [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 21, 2003 4:58 PM
> To: OJB Users List
> Subject: Re: problems with batch-mode=true
> 
> 
> Hi Bonnie,
> 
> Hope I can sheed some light on the 'problem'.
> 
> > does this mean that you can't set batch mode to "true"
> > if it is set to "false" in repository_database.xml?
> yep!
> I think this behaviour has a big advantage, because it is
> easy to disable batch-mode by set batch-mode false in
> repository (if we don't have a bug in handling bach-mode ;-))
> 
> ...
> >> I am trying to insert records in batch mode. Perhaps I 
> don't understand
> >> how this
> >> works. Here is my test code to insert 100 customers :
> >>
> 
> Assume you have set batch-mode 'true' in repository
> file. Then you have to enable batch mode for the use
> PB instance.
> Try this:
> 
> >>         ConnectionManagerIF conMan = 
> broker.serviceConnectionManager();
> >>         try
> >>         {
> >>             broker.beginTransaction();
> 
> ==>>             broker.connectionManager.setBachMode(true);
> now the PB instance is running in batch-mode till you set
> false or the PB instance was closed.
> >>             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();
> think you don't need executeBatch before commit, this will be done
> at commit.
> >>             broker.commitTransaction();
> >>               }
> >>
> 
> If you still have problems with batch-mode try CVS-head. I think
> Oleg has checked in some changes (but I'm not sure)
> 
> regards,
> Armin
> 
> >> When I run this with batch-mode="false", it works 
> perfectly, although it
> >> generates a SELECT and a
> >> DELETE for every INSERT (which seems rather inefficient). 
> I imagine this
> >> has something to do with
> >> an M:N nondecomposed relationship which involves Customer records.
> >>
> >> When I run this with batch-mode="true", it fails. I get 
> the following
> >> exception
> >> 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.PreparedStatementInvocationHa
> ndler.doExec
> >> ute(Unknown Source)
> >>    at
> >> 
> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHa
> ndler.invoke
> >> (Unknown Source)
> >>    at $Proxy0.doExecute(Unknown Source)
> >>    at
> >> 
> org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown
> >> Source)
> >>    at
> >> 
> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut
> eBatch(Unkno
> >> wn Source)
> >>    at
> >> 
> com.mobius.activebill.dbmigrationutils.CustomerMigration.main(
> CustomerMigr
> >> ation.java:68)
> >> rethrown as 
> org.apache.ojb.broker.accesslayer.OJBBatchUpdateException:
> >> object is not an instance of declaring class
> >>    at
> >> 
> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut
> eBatch(Unkno
> >> wn Source)
> >>    at
> >> 
> com.mobius.activebill.dbmigrationutils.CustomerMigration.main(
> CustomerMigr
> >> ation.java:68)
> >> when conMan.executeBatch() is called.
> >>
> >> Am I doing something wrong here? I am using rc4, with 
> MSSqlServer and
> >> JSQLConnect.
> >>
> >> thanks,
> >> Bonnie MacKellar
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to