I understand that things are working "correctly", but I am looking for ideas or links to ideas for how to make this work the way i need it to.
I am using Spring's SessionInViewInterceptor with flushMode set to FLUSH_AUTO. This means that anything live hibernate object that changes gets persisted automagically, and its easy for development. Trade off is obviously less control. Less control is fine because we have no business transactions that need commit/rollback.
EXCEPT, for form validation. Using Spring BIND tags, the Spring framework creates a Command object from the the form post which is one of my hibernate classes. This is great for create/edit/save, BUT when I need to do custom DB validation (i.e. checking for duplicate emails), doing that DB check turns my POJO into a hibernate object and it gets persisted even if the validation fails.
Again, I know this is correct, but are there any ideas for how to keep the simple SIVInterceptor pattern, but allow for checking data in the DB for an object before persisting? Evicting the object first maybe? Creating a separate Session? (No) Thoughts?
Thanks for any ideas... =)
Hibernate version: 3.0.3
Spring version: 1.2
|