You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Emmanuel Dupont <em...@jwaretechnologies.com> on 2003/10/22 15:11:30 UTC
RE : RE : problems with batch-mode=true
Thanks a lot Bonnie.
-----Message d'origine-----
De : Bonnie MacKellar [mailto:BMACKELL@mobius.com]
Envoyé : mercredi 22 octobre 2003 15:05
À : OJB Users List
Objet : RE: RE : problems with batch-mode=true
If I am understanding it correctly, it is supposed to be
a way to interface with the underlying batch mode in JDBC.
There, you add insert statements to a batch, and then
execute them all at once. It should save on overhead.
We have to migrate a large customer database, so we
need any overhead savings we can get.
Please, anyone who knows more than me about this, correct
me if I am wrong!
Bonnie MacKellar
software engineer
Mobius Management Systems, Inc.
bmackell@mobius.com
> -----Original Message-----
> From: Emmanuel Dupont [mailto:emmanuel.dupont@jwaretechnologies.com]
> Sent: Wednesday, October 22, 2003 2:34 AM
> To: 'OJB Users List'; armin@code-au-lait.de
> Subject: RE : problems with batch-mode=true
>
>
> 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:armin@code-au-lait.de]
> 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.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: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org