You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dale Becker <da...@gmail.com> on 2005/11/08 13:12:34 UTC

Tapestry and Hibernate Lazy Loading

I am trying to use lazy loading in Tapestry 3.0.3 and cannot get it to work.


I have in the meantime made my object model use join="fetch" to get the
sub-objects data (which affectively disables lazy loading). But this means
our application loads large amounts of data when it is not needed.

This is all ok when dealing with one instance of an object as the object
graph is not too bad for one object - the problem arises when we do
searches.

When doing a search the system might be loading a few thousand instances of
that large object graph. Which causes major performance issues for us.

I have tried managing the session across requests using the Spring
"OpenSessionInView" Filter but that does not help as Tapestry pages keep
around object references that were loaded during previous requests.

If some part of the object graph is lazily loaded, it isn't always possible
to reattach it to the current session, because there is not enough
information in the proxy, this is the case for example with a polymorphic
class.

Can anyone shed some light on this for me - I desperately need to get this
working.

Re: Tapestry and Hibernate Lazy Loading

Posted by Ted Steen <te...@gmail.com>.
I'm having the same problem.
I, on the other hand, have found a "sollution" to the problem.
As far as I can see, people are talking about reconnecting the object
to the session using this technique:
http://wiki.apache.org/jakarta-tapestry/SpringHibernate?highlight=%28hibernate%29
look at the bottom of the page ("The last trick is to get the lazy
mode working").
I dont know if this is the correct way to do it. I've been thinking
about the "datasqueeser way" to do it, but tapestry doesn't (what I
have heard) squeese all objects that gets passed between pages. I'm
not that into tapestry yet.
If you find out how to do it in i "nice" way, please let me know!

Greets!
Ted

On 11/8/05, Dale Becker <da...@gmail.com> wrote:
> I am trying to use lazy loading in Tapestry 3.0.3 and cannot get it to work.
>
>
> I have in the meantime made my object model use join="fetch" to get the
> sub-objects data (which affectively disables lazy loading). But this means
> our application loads large amounts of data when it is not needed.
>
> This is all ok when dealing with one instance of an object as the object
> graph is not too bad for one object - the problem arises when we do
> searches.
>
> When doing a search the system might be loading a few thousand instances of
> that large object graph. Which causes major performance issues for us.
>
> I have tried managing the session across requests using the Spring
> "OpenSessionInView" Filter but that does not help as Tapestry pages keep
> around object references that were loaded during previous requests.
>
> If some part of the object graph is lazily loaded, it isn't always possible
> to reattach it to the current session, because there is not enough
> information in the proxy, this is the case for example with a polymorphic
> class.
>
> Can anyone shed some light on this for me - I desperately need to get this
> working.
>
>


--
/ted

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


Re: Tapestry and Hibernate Lazy Loading

Posted by Dale Becker <da...@gmail.com>.
Dale Becker <dale.becker <at> gmail.com> writes:

> 
> Does Howard have any ideas on whether is solution is being planned for T4?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe <at> jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help <at> jakarta.apache.org
> 
> 


I found this wiki for T4 that uses a DataSqueezer but alas I am still on T3.0.3
and cannot upgrade as the product we work on is in production (but it might help
someone else): 

http://wiki.apache.org/jakarta-tapestry/HibernateTapestrySqueezer



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


Re: Tapestry and Hibernate Lazy Loading

Posted by Dale Becker <da...@gmail.com>.
Does Howard have any ideas on whether is solution is being planned for T4?


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


Re: Tapestry and Hibernate Lazy Loading

Posted by Christian Haselbach <ch...@tngtech.com>.
Quoting Dale Becker <da...@gmail.com>:

> I have tried managing the session across requests using the Spring
> "OpenSessionInView" Filter but that does not help as Tapestry pages keep
> around object references that were loaded during previous requests.
>
> If some part of the object graph is lazily loaded, it isn't always possible
> to reattach it to the current session, because there is not enough
> information in the proxy, this is the case for example with a polymorphic
> class.

This is a common problem. To avoid this problem, we either only store the
ids of the objects or reload the objects according to their id if needed.

Ciao Christian

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