I imagine that if you use Spring's declarative transactions on the service layer so that the read()/get() method does not start a read/write transaction but the save() method does then changing the object without calling "save()" should just work - you won't be in a read/write tx and so the changes to the object won't be persisted. I haven't tested this.
lasitha <[EMAIL PROTECTED]> wrote: On Nov 19, 2007 10:35 PM, Thiago H de Paula Figueiredo wrote: > I havent't noticed this problem before. Until now, HiberTapestry opens a > transaction when a service method annotated with @Transactional is invoked > and commits it when the method finishes without exceptions. Otherwise, the > transaction is aborted. Let me describe the problem in a little more detail. Assuming a typical OSIV setup, consider the following sequence of events: 1. A form is submitted. 2. The entity that backs the form is retrieved from the db in onActivate() or onPrepare(). 3. The first set of validations pass and the entity's fields are populated by tapestry. 4. Our onValidate() method finds some problem and records errors on the validation tracker. 5. Tapestry redirects back to the same page so the user can correct their inputs. 6. The request ends and the active session is flushed. In the above sequence, we don't want to commit the modifications to our entity, but the automatic dirty check initiated when the session is flushed will detect and commit the changes from step 3. Note that the method to save our changes (that is presumably @Transactional) is not even reached in this scenario because we never hit onSuccess(). Does that make sense? Max, Jonathan and Ognen seem to confirm that this is indeed a real consideration. I suspect the solution is as simple as setting the hibernate flush mode to MANUAL (and switching it AUTO just for the duration of an explicitly declared transaction) - the way the spring folks do it. Cheers, lasitha. P.S. I goofed up the link to the spring OSIV interceptor in my previous post. Here's the correct one: http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]