File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "what is real world uses of savepoint?" Watch "what is real world uses of savepoint?" New topic

what is real world uses of savepoint?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
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?
Jan Cumps

Joined: Dec 20, 2006
Posts: 2565

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
I agree. Here's the link:
subject: what is real world uses of savepoint?
It's not a secret anymore!