This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes commit and rollback question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "commit and rollback question" Watch "commit and rollback question" New topic

commit and rollback question

Karan Jain
Ranch Hand

Joined: May 30, 2007
Posts: 82
I have the following requirement:
1. Upload the file on to server using commons file upload.
2. Generate a unique key using Oracle Sequence and insert a row in the file table stating file is uploaded.
3. Save the file using the unique key as name on the server.
4. Validate the file records for format errors and if there are errors show all the errors to the user in a popup window on top of the upload page.
5. If there are no format errors, store each individual record in the database in a temp table.
6. Now confirm with the user whether he really wants to release the records. (Weird but true)
7. If user says YES then read each record from the temp table and send it to business process for data validation and store mark the record as complete and store the data in the final table.
8. If user says NO then delete all the records from the temp table and delete the file on the server.

1) How to use transaction for making this process work?
2) If I insert all the records without committing and then ask the user if he really want to release the records� If user says no� I do nothing� Will the records will be gone from the database as I have not committed? If user says yes and go ahead and commit� but how to go back to server and do the commit??

Is there any good and robust way of achieving this functionality?

Any help is appreciated.

Don't get me started about those stupid light bulbs.
subject: commit and rollback question
Similar Threads
taking user response in middle of server processing?
RecordNotFoundException and unlock
Advice on Checking the data with database
Share parts of my choice.txt with javaranchers
Performance Problem?