Meaningless Drivel is fun!
The moose likes EJB and other Java EE Technologies and the fly likes Undo features... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Undo features..." Watch "Undo features..." New topic

Undo features...

Gurumurthy Ramamurthy
Ranch Hand

Joined: Feb 13, 2003
Posts: 273

Undo features can be accomplished using Memento pattern, also I have learnt that it is possible with command patter too...How?

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You might prefer the OO, UML, etc. forum down the page for questions like this. We love this kinda stuff down there.

Memento can be used for undo by storing all state or the state that changes on every change. To undo you simply restore the most recent saved state.

Command can be used to undo by storing compensating commands. To undo you execute the most recent command. So if the change was to insert a new row in the database the undo might be a matching delete command.

I've seen these used in transaction rollback. If you update a database and a flat file in a transaction, you probably have to write your own rollback for the flat file.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Undo features...
It's not a secret anymore!