-->
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.  [ 4 posts ] 
Author Message
 Post subject: Troubles with "lazy" option
PostPosted: Sat Oct 21, 2006 1:11 pm 
Beginner
Beginner

Joined: Tue Sep 19, 2006 1:48 pm
Posts: 20
Hibernate version: 3.1.3

Mapping documents:
Code:
<hibernate-mapping>
   <class name="modele.Membre">

...

      <bag name="amis" lazy="true">
         <key column="Membre_idMembre"/>
         <one-to-many class="modele.Ami"/>
      </bag>
   </class>
</hibernate-mapping>


I have an entity "Membre" which owns n "Ami", but I would like those "Amis" to be loaded from my DB each time I call getAmis() from my Membre bean.
I tried both lazy="true" and lazy="false" and I always get the same result :
"Amis" are loaded when my Membre is loaded :( No query is executed each time I call getAmis()


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 5:02 pm 
Beginner
Beginner

Joined: Tue Sep 19, 2006 1:48 pm
Posts: 20
Maybe I'm taking the wrong way?
In other words, how can I get an update from my DB EACH TIME I call a particular getter?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 6:30 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
you have to invoke a operation on amis before the proxy gets intialized..

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 24, 2006 2:10 am 
Beginner
Beginner

Joined: Tue Sep 19, 2006 1:48 pm
Posts: 20
And how could this be done?
Would a simple merge() in the getter be enough?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.