Spring batch - Commit failed while step execution data was already updated error at custom writer -


after writer class ends. error occurs in spring batch execution. of read data rollback , chunk data not inserted db.

what mean of "commit failed while step execution data updated error"? , why occur log?

is problem may time of insert transaction in writer?

if there 1 time of insert transaction(commented out 'recorddataservice.insertrecorddata(recorddata);', there no problem.

my code :

    @override     public void write(list<? extends recordinfo> items)  {      log.info("########################################################");     log.info("write");     log.info("########################################################");      recordinfoservice.insertrecordinfo(recordinfos.get(0));      for( recorddata recorddata : recordinfos.get(0).getrecorddatalist()){                 recorddataservice.insertrecorddata(recorddata);     } 

the log of each other writer :

2015-07-17 00:05:38.995  info 42558 --- [           main] c.s.c.b.j.c.collectrecorditemwriter      : ######################################################## 2015-07-17 00:05:38.995  info 42558 --- [           main] c.s.c.b.j.c.collectrecorditemwriter      : write 2015-07-17 00:05:38.995  info 42558 --- [           main] c.s.c.b.j.c.collectrecorditemwriter      : ######################################################## 2015-07-17 16:34:26.921  info 41111 --- [           main] o.s.jdbc.support.sqlerrorcodesfactory    : sqlerrorcodes loaded: [db2, derby, h2, hsql, informix, ms-sql, mysql, oracle, postgresql, sybase, hana] 2015-07-16 02:30:25.734  info 60636 --- [           main] o.s.batch.core.step.tasklet.taskletstep  : commit failed while step execution data updated. reverting old version. 

the log of execution : rollback

+++++++++++++++++++++++++++++++++++++++++++++++++++++  step collectrecordstep  writecount: 0 readcount: 14 readskipcount: 0 commits: 1 skipcount: 0 rollbacks: 14 filter: 0 +++++++++++++++++++++++++++++++++++++++++++++++++++++  


Comments