|
|
How to implement open session view interceptor and reattch objects
Hi ,
So far we were not using hibernate lazy loading and now our
application the performance is very bad.
So I was looking at OpenSessionViewInterceptor (we are using
Webwork2.2 , Spring 1.2 and Hibernate3.1).
I'm trying to write a webwork interceptor as
public class OpenSessionViewInterceptor implements Interceptor {
public String intercept(ActionInvocation actionInvocation) throws Exception { try{ //open hibernate session session
//re-attach webwork session object to hibernate session (like merge()) return actionInvocation.invoke(); } catch(Exception e) {} finally{ //close the session }
}
}please suggest me how to handle my problems.
1. How to open the hibernate session and reattach the webwork session
objects using existing springs
2. Is there any way to open a different hibernate session and reattach
the objects just for JSPs view data and avoid LazyInitializationException. -so that my existing transaction boundary still be same
3. If i can use existing Spring interceptor to solve my problems,
please tell me how to configure it. and how to reattach webwork session objects to hibernate session.
I have attached the my beans definition in beans.xml file.
I use manager objects for CRUD operations (for example , UserManager)
Thanks In advance for your time.
~Bhim |
|