Osian Hughes wrote on Nov 26, 2009 13:52:
This seems like a big overhead, and possible cause for problems if we have to refresh each and every object that might have been touched.
Is there no easy way to tell the Session to forget about any changes?
Well, you could always call Session.clear(), it would forget everything :) Depending on your application, that might not be desirable, though: if you go back to the entity list page, for example, you'll have to reload from the DB, etc. Anyway, refresh() is convenient for implementing undo, but that is not what it is designed for. You could work with detached classes instead, that would make undo really easy (simply don't merge), but as we know has other disadvantages. So no easy solution for this, AFIK, you have to either clear everything or carefully reattach all associations.
Thanks for the reply.
It seems strange that there is no easy solution for this! With EOModeler you could always call revert on the session and all changes would be rolled back.
Is it possible to have a different session created for the Home page? and then calling clear on this wouldn't impact on the main session? or is this going down the wrong route??
AFAIK (never used those), nested conversations where supposed to offer this, but there are a number of problems with those, so you better avoid them. You can always implement this yourself, but it's not supported out of the box. There are some ideas on the forum though.
I had the same thoughts with nested conversations, but I am still unable to get separate conversations running in my application.
Any pointers on which posts I should look at for how to implement some kind of undo functionality?