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 JDBC and the fly likes what is real world uses of savepoint? 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 » Databases » JDBC
Bookmark "what is real world uses of savepoint?" Watch "what is real world uses of savepoint?" New topic
Author

what is real world uses of savepoint?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for reading my post
Can you please explain what is uses of savepoint in real world applications?
I read that savepoint can help us to shorten the rollback window, it means that we can rollback half of a transaction instead of all of it.
I can not understand why we should commit or rollback half of a transaction?
thanks
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Savepoints can be used if you want finer control over your transaction than: if it fails I discard everything, and start from scratch.

It makes sense to use savepoints if you are able to correct the cause for the rollback to that savepoint in your application.

One use case could be that it's too expensive to discard and redo all the work done in a transaction:

Expedite order scenario:
- start transaction
- allocate stock (an expensive operation)
- set Savepoint stock allocated
- make truck reservation
- reservation fails
- rollback to Savepoint stock allocated
- correct truck reservation issue and retry
- commit transaction

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
 
 
subject: what is real world uses of savepoint?
 
Similar Threads
Multiple updates
Save point in Java Transactions
SavePoint in JDBC
I have name of a savepoint, can i rollback to that savepoint?
Query about rollback() method