• Post Reply Bookmark Topic Watch Topic
  • New Topic

When commit transaction

 
Samy Ganou
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table containing records with a status = not_processed.
I have to do a job that take each record and try to call a workflow to get a value , update this record with the value and set status=Processed.
The processing of a record is independant of the other records .
So i will have to use one transaction for all records and commit it at the end of program or , a new transaction for each record and commit just after the update of the record ?

Thank you.
 
Hadi Zeftin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so you tryin to create a batch job that take each record, do some processing, and update the records ?

I don't see why you need a transaction for this kind of requirement?
 
Eduardo Yañez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samy Ganou wrote:I have a table containing records with a status = not_processed.
I have to do a job that take each record and try to call a workflow to get a value , update this record with the value and set status=Processed.
The processing of a record is independant of the other records .
So i will have to use one transaction for all records and commit it at the end of program or , a new transaction for each record and commit just after the update of the record ?

Thank you.


If you use only one transaction and commit it at the end, records' updates will be dependent, if one of them fails the rollback will put them all in their previous states.
So you need a transaction for each register.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!