Are you positive that hibernate will write this data to the session? The default flush mode of Spring's OpenSessionInViewFilter is "NEVER":
http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.html#setFlushMode(org.hibernate.FlushMode) I would try a simple test. Create a form that edits a bean that you retrieve from the database (you retrieve it using a DAO/Repository with a transaction demarcation of readOnly/required). Try to edit the object but have it fail validation (don't set a required field or something). Then, check your db to see if the values are there. On Thu, Jun 26, 2008 at 4:30 AM, cretzel <[EMAIL PROTECTED]> wrote: > > Thanks for the immediate replies. > > Seems that, when using that pattern, one really always has to be aware of > the fact that changes are made directly to persistent instances. Otherwise > it could easily happen to get inconsistent data into the DB. > > > Michael Sparer wrote: >> >> I'd say either enable transactions only for write operations or put all >> together in one transaction (i.e. don't let hibernate flush the session >> before you did your backend checks) ... >> > > This works if each request is a single transaction. If multiple transactions > are run in one request, this wouldn't help, I think. > > > igor.vaynberg wrote: >> >> map a form to a bean and apply the changes to the entity yourself or do >> all validation via I(Form)Validators >> > > The first solution sounds like using DTOs and one reason of using OSIV is to > not to have to use DTOs. > > But I like the FormValidator solution. That should work in most cases. > > Regards > > > > -- > View this message in context: > http://www.nabble.com/OpenSessionInView-%28OSIV%29%2C-LoadableDetachableModel-and-Transactions-tp18115802p18129013.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
