ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ann Carpentier <ann.carpent...@guest.minfin.fed.be>
Subject ignore failed record and continue the rest of records in the batch?
Date Fri, 30 Mar 2007 07:29:43 GMT
Hi,

 

I've a question about the commit & rollback of the ibatis-batch.

 

As I understood, executeBatchDetailed will still rollback all statements
between startBatch and executeBatchDetailed. is that right? Is there a way
to ignore the failed record (just log the failed one) and continue the rest
of records in the batch?

 

This is my code:

 

 

                        KEtatCivilJdbcDao kEtatCivil = new
KEtatCivilJdbcDao();

      

        

        DAOUtil.getInstance(Constants.SQLMAP_DU).startTransaction();

        DAOUtil.getInstance(Constants.SQLMAP_DU).startBatch();

        

        KCodeVO vo = new KCodeVO();

        kEtatCivil.insert(vo);

        kEtatCivil.insert(vo);

        kEtatCivil.insert(vo);

        kEtatCivil.insert(vo);

        kEtatCivil.insert(vo);

        

        // geeft een fout!

        kEtatCivil.insertFout(vo);

        

        kEtatCivil.insert(vo);

        

 
DAOUtil.getInstance(Constants.SQLMAP_DU).executeBatch();

 
DAOUtil.getInstance(Constants.SQLMAP_DU).commitTransaction();

        DAOUtil.getInstance(Constants.SQLMAP_DU).endTransaction();

 

The problem is, that when we're at the step 'executeBatch', he crashes on
the commit of the insertFout (foreign key doesn't exists). The problem is,
that the queries after insertFout aren't executed. Is there a way to ignore
the failed record and continue with the rest of records in the batch?

 

 

Thx,

Ann



----------------------------------------------------------------
- Disclaimer: http://www.minfin.fgov.be/disclaimer.htm

Mime
View raw message