Can you do batch w/ plain JDBC w/o a transaction?
On 5/3/05, Simon Brunner <lists@simonbrunner.com> wrote:
>
> List,
>
> we just started a project from scratch and chose Spring/iBatis/Struts to
> build a mid-size J2EE web application. First I've to say that I'm very
> impressed on how fast you get productive by using iBatis. Everything went
> smooth until I wanted to do a batch insert. As we write JUnit testclasses
> for the entire app I used my iBatis DAOS without Spring's transaction
> demarcation (simply invoked the Dao by a test class). Under that
> environment iBatis executed my batch statements as single inserts until I
> read these lines in the mailing list archive:
>
> > Clinton Begin
> > Wed, 01 Dec 2004 12:00:53 -0800
>
> >> I'm currently using IBatis version 2.0.3. I'm not able to work upon
> with
> >> Batch. I'm
> >> doing the following :
> >> sqlMap.startBatch();
>
> > Are you starting a the transaction too? So...
>
> > startTransaction()
> > startBatch()
> > insert...
> > update...
> > executeBatch()
> > commitTransaction()
> > endTransaction
>
> Then I added transaction-support to my Spring Dao and it worked. Now I
> wonder why the execution of batch updates relys on the start and commit of
> a transaction?
>
> Thanks & best regards
>
> Simon
>
>
--
Brice Ruth
Software Engineer, Madison WI
|