I read inb the doc but I didn't understood what the batch mode="true" means.
Can someone explain it to me ? Tx ! -----Message d'origine----- De�: Armin Waibel [mailto:[EMAIL PROTECTED] Envoy�: mardi 21 octobre 2003 22:58 ��: OJB Users List Objet�: 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.PreparedStatementInvocationHandler.doExec >> ute(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.accesslayer.ConnectionManagerImpl.executeBatch(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.executeBatch(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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
