0

i'm working with spring batch with hibernate as data access layer. My job has tree steps. In the last step i need to do an explicit commit (flush) during my job inside an ItemWriter, because i have to read a database view that needs specific data persisted before.

I set a specific jtatransactionmanager, when the execution starts, in the first step, it caught an exception:

org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: You cannot commit during a managed transaction!

thank's in advance

stegada
  • 289
  • 1
  • 2
  • 9
  • the commit happens after the chunk, see http://static.springsource.org/spring-batch/reference/html/configureStep.html#commitInterval, that is a mandatory behaviour to achieve safe roll-back and retry scenarios, can you give more information about the actions of your batch and the specific writer? – Michael Pralow Feb 19 '13 at 11:56
  • In the last step, the specific writer performs these actions: 1)calls a component that insert rows into my DataBase and performs an explicit hibernate flush. 2)reads a database view created by rows reviously inserted 3)implements a business logic. 4)inserts data results into Database. But, process goes in error just on first step. – stegada Feb 20 '13 at 10:54

0 Answers0