You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lbastil <ba...@gmx.de> on 2007/10/26 10:52:51 UTC

[s2] Problems with lazy loading (open session in view approach)

In our application we need to lazy load fields in the view.

We have configured springs OpenSessionInViewFilter.

If we use lazy loading from a normal JSP View, everything works fine.

But on our View we also have AJAX tabbedpane with remote div's.

Now the problem is:
within the content of this remote divs lazy loading is not possible for us,
we receive:

org.hibernate.LazyInitializationException: failed to lazily initialize a
collection of role: de.verwalt_berlin.senbjs.is
bj.portal.eud.model.Traeger.ansprechpartner, no session or session was
closed
       at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentColl
ection.java:358)
       at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(Abstract
PersistentCollection.java:350)
... 

Do we have to configure something special in this case?
Do we have to manually open session again?
Is there some documentation about Open Session in View and AJAX? 
Is it possible with ajaxed div's at all?

Thank you in advance,
basti
-- 
View this message in context: http://www.nabble.com/-s2--Problems-with-lazy-loading-%28open-session-in-view-approach%29-tf4695942.html#a13423079
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [s2] Problems with lazy loading (open session in view approach)

Posted by lbastil <ba...@gmx.de>.
Just found the problem cause:

what was not mentioned:

in the requests initiated by the remote divs the model is retrieved from
session.
For the model no hibernate session is attached, so non of the not already
loaded
lazy loading fields are available.

Seems we have to:
a) attach session manually (which means: action have knowledge about
hibernate ... bad?)
b) adding some service method which loads the field / collections
explicitely
c) some other?

Thank you,
Basti


lbastil wrote:
> 
> In our application we need to lazy load fields in the view.
> 
> We have configured springs OpenSessionInViewFilter.
> 
> If we use lazy loading from a normal JSP View, everything works fine.
> 
> But on our View we also have AJAX tabbedpane with remote div's.
> 
> Now the problem is:
> within the content of this remote divs lazy loading is not possible for
> us,
> we receive:
> 
> org.hibernate.LazyInitializationException: failed to lazily initialize a
> collection of role: de.verwalt_berlin.senbjs.is
> bj.portal.eud.model.Traeger.ansprechpartner, no session or session was
> closed
>        at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentColl
> ection.java:358)
>        at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(Abstract
> PersistentCollection.java:350)
> ... 
> 
> Do we have to configure something special in this case?
> Do we have to manually open session again?
> Is there some documentation about Open Session in View and AJAX? 
> Is it possible with ajaxed div's at all?
> 
> Thank you in advance,
> basti
> 

-- 
View this message in context: http://www.nabble.com/-s2--Problems-with-lazy-loading-%28open-session-in-view-approach%29-tf4695942.html#a13423872
Sent from the Struts - User mailing list archive at Nabble.com.


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