struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Struts - Spring - hibernate and lazy initialization
Date Wed, 02 Apr 2008 20:19:17 GMT
Yayo on 02/04/08 20:23, wrote:
> I'm developing  a struts - spring based application.
> 
> I've got actions-delegates-managers and daos and I use the open session in
> view filter from hibernate.
> 
> In some cases I've got to return lazy results to the user so I've got to
> launch a new worker thread and taht new one doesn't have an hibernate
> session attached so I've added hibernateInterceptors to my managers.


Hi Yayo,
that paragraph doesn't sound right. You say 'lazy results' and so I understand 
you want your hibernate entities to lazy load - is that correct?

If that is correct, I don't see the connection with what you say 'launches a new 
worker thread'. Why do you do that? If you need lazy loading, you make sure the 
Hibernate session is still running, which you have already because you use the 
OpenSessionInViewFilter.

What is the reason for launching a new thread? The idiomatic spring/hibernate 
approach doesn't require that. You just pass your hibernate entities around and 
as long as the session is running, it will be fine.


Regards
Adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message