Fred Lamuette wrote:
I'm using almost the same pattern as you, I've created an interceptor that
loads the model in the action
(detection of the id paramter and extension of the ModelDriven interface to
add setModel(..) and getModelClass() method, thus I can load and store
easily my entity in my ModelDriven action). It works really great.

The only problem is the following one :
1/ My model is populated in my interceptor
2/ The validation interceptor finds errors on my model
3/ How can I elegantly "rollback" the changes made on my model whithout
Hibernate saves the change in db when closing the session, in the after
method?

One way to prevent Hibernate from saving these unwanted changes is to evict the object from the session cache.


Iterator cats = sess.iterate("from eg.Cat as cat"); //a huge result set
while ( cats.hasNext() ) {
    Cat cat = (Cat) iter.next();
    doSomethingWithACat(cat);
    sess.evict(cat);
}

M




------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to