Regarding to not using servlet filters for the OpenSessionInView
approach, I can confirm that other approaches work!
First of all,
i've always used the HibernateUtil class posted in hibernate forums
(and maybe also included in Hibernate in Action) that stores and gets
session and transaction objects in thread local variables.
So, opening a hibernate session is never a problem (whichever method
first uses one, creates it) and so it only remains the issue of closing it
somewhere.
I haven't tried the cleanupAfterRequest() of Engine approach.
Instead i've always extended the
pageEndRender(PageEvent event)
in a BasePage (that all my pages extend) and there I just do:
super.pageEndRender(event);
HibernateUtil.closeSession();
The nice thing is that this closeSession() never complains, no matter
if no session is found, or if it has already been closed.
Anyway, I can post the HibernateUtil class here if you want to...
Andreas
Alejandro Scandroli wrote:
Henry Chen wrote:
I have been searching around desperately for solution of handling
lazy-loading database objects in tapestry. I configured
OpenSessionInViewFilter for Tapestry pages. It worked for some cases
but not all. For example, in the table component, the first page was
good, but when I selected other pages, it gave me the
LazyInitialization exception - owning session was closed. Is there any
way around it now? Thanks a lot!
Hi , I'm having the same problem on Trails.
This quote may help.
quote form Open Session in View discussion on Hibernate site.
<quote>
Open Session pattern and Tapestry web framework
24 Mar 2004, 19:27 wassup
If you develop your application with Tapestry framework it is better
do not use Servlet Filters to manage request cycle. More preferable to
override setupForRequest() and cleanupAfterRequest() of Engine
class.
</quote>
I have no time to try this.
Please let me know if it works for you, or if you find another workaround.
Saludos.
Alejandro.
PD:- please, excuse my English.
---------------------------------------------------------------------
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]