You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jens Halm <ml...@oregano-server.org> on 2003/12/19 22:24:40 UTC

Re[2]: struts, hibernate, datasources .... so lost

DE> Regarding what happens after you load something from Hibernate.  I'm still
DE> learning this myself, but I assume if you don't load ANYTHING lazily then
DE> you should be able to do anything with that variable and have no worries.
DE> However if you have an object that contains say a set of other objects, ie a
DE> team with a set of players, and set it to lazy loading, meaning when you
DE> load team 1, the players arent loaded until you call, getPlayers(), then at
DE> that point hibernate is still bound to your variable and will load that from
DE> the db assuming the session you initially loaded the team with is still
DE> open.  Make sense?  The way it works is hibernate has its own classes
DE> inherited from set/list/map etc that handle that.. and it uses those when
DE> you load sets.

Yes, makes sense. But there is a way you can close the Hibernate
Session before forwarding to the JSP, if you explicitly initialize all
objects that you need in the view with Hibernate.initialize() before
closing the session.


Jens
www.oregano-server.org



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