-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Lazy Initialization doesn't work
PostPosted: Thu Nov 30, 2006 11:49 am 
Newbie

Joined: Wed Sep 20, 2006 7:42 am
Posts: 12
Location: Sweden
Hi,

I'm trying to the get a Set lazily initialized, but it doesn't work.

Team t = (Team)session.get("Team", new Integer(1));

A team concists of games. Despite not writing t.getGames() there are games asscociated to the instance (I see this in hibernate output logs and the fact I can reference it even when the session is closed)

<set name="games" inverse="true" lazy="true">
<key column="teamid"/>
<one-to-many class="eg.Game" />
</set>

I'm getting crazy. Why doesn't it work?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 11:52 am 
Newbie

Joined: Thu Nov 30, 2006 11:05 am
Posts: 5
Can you try printing t.getGames().iterator().next().getXXX() , where XXX could be any attribute of a Game.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 3:38 am 
Newbie

Joined: Wed Sep 20, 2006 7:42 am
Posts: 12
Location: Sweden
Yes, I tried it now and I got no nullpointer or lazy initialization error. I have another project and there the lazy initialization it works fine... same collection of libs.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.