You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ann Carpentier <an...@guest.minfin.fed.be> on 2007/03/30 09:29:43 UTC

ignore failed record and continue the rest of records in the batch?

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