struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric D Nielsen <niels...@MIT.EDU>
Subject Re: Fundamental flaw in Model-Driven?
Date Wed, 30 Apr 2008 14:23:00 GMT
Another possible solution I want to try exploring (but unfortunately its
Hibernate specific) is making a custom version of the validator interceptor:

Inject the session into the interceptor
Call session.readOnly(entity,true) on failed validation

If I'm reading things correctly this should
a) keep the session alive (versus issuing a rollback), keeping the object
attached and allow lazy loading
b) stop any of the dirty data in the object from getting pushed back on 
or explicit flushes

In fact I might flip set readOnly(entity,true) on entrance to the validator
interceptor and then set it to false on success.  This should allow the
validators of submitted version stored quantities to proceed --

for instance the classic example of Order value can't exceed X, when adding a
new LineItem -- the validation might trigger a lazy load of the LineItems, so
the entity must be "persistence read-only" before any validation starts to
avoid writing dirty values back.

This still feels like a hackish solution ( and one that probably can't be
distributed/incorporated by/into Struts 2's official jars ), but it looks


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message