Keyword: struts2 preparable, spring OpenSessionInViewFilter, hibernate
transaction management.

Background: 

We use OpenSessionInViewFilter in our web xml to enable lazy loading in web
views.

The struts action class provides a basic function in adding, updating and
deleting data entity as a controller.

Our form fields reference the entity object and its properties with a valid
OGNL expression...
 like <s:textfield name="organisation.phoneNumber"></s:textfield>

The submitform's action does nothing to D.B.

Problem: 

Case A: 
 
The struts action does not implement Preparable interface and we use some
private method to initialize the data used .

The jsp uses the entity expression directly. <s:textfield
name="organisation.phoneNumber"></s:textfield>

As a result, whenever you make any change in the jsp for this entity and
submit the form, it does not go to the D.B.

Which is good because this is exactly what we want as “Open Session in
View”, which is read-only. 

 

Case B: 
 
The struts action does implement Preparable interface and in the
implementation, we retrieve the data from database and populate its original
value.

And the jsp uses the entity expression directly. <s:textfield
name="organisation.phoneNumber"></s:textfield>

As a result, whenever you make any change in the jsp for this entity and
submit the form, it changes the D.B.

My question is the case B:

How does  "Preparable" influence hibernate transaction management? Anyone
has any idea? 


I guess it is related to the struts 2 Interceptor, which does have some
influence to the spring, which then influences the hibernate transaction
control.

I post the problem in struts forum, not spring or hibernate forum,  because
if I do not use "Preparable", everything works as expected. 


cheers
Jack



-- 
View this message in context: 
http://www.nabble.com/%22Preparable%22-influence-hibernate-transaction-management-when-using-%22OpenSessionInViewFilter%22-tp19660675p19660675.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to