aspose file tools*
The moose likes JDBC and the fly likes When commit transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "When commit transaction" Watch "When commit transaction" New topic
Author

When commit transaction

Samy Ganou
Greenhorn

Joined: Oct 05, 2009
Posts: 28
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

Joined: Jun 03, 2010
Posts: 8
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

Joined: Oct 09, 2008
Posts: 92

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.


http://serfj.sourceforge.net - Simplest Ever REST Framework for Java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When commit transaction