That's correct - if you make an entity dirty while it's attached to a
session the changes will be committed when the session is flushed.
You've made an attached object dirty, so you either have to detach it
when validation fails or force hibernate not to commit it (don't allow
it to flush). Perhaps www.hibernate.org has docs on this use case.
Personally I think writing to attached entities from the view is a bad
idea precisely due to this issue (and exception handling, and others),
even though it's recommended practice on the struts2 wiki.
Alberto A. Flores wrote:
Is anyone using openSessionInView with Struts 2 (Hibernate, Spring)?
I've found a problem where a domain model is still persisted (even
though I'm not saving it) after validation finishes (showing
validation errors). My prepare method makes a query (using a
HibernateTemplate().get() method) but that's all? Has anyone seen
something similar?
I'm very sorry if this is not a Struts2 question, but thought of
asking since Struts2 is using Filters now and was wondering if anyone
has seen any similar behavior.
Thanks,
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.17.4/1187 - Release Date: 16/12/2007 11:36 AM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]