-->
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.  [ 6 posts ] 
Author Message
 Post subject: set with many-to-many doesn't want to be lazy
PostPosted: Wed Jun 02, 2004 5:51 am 
Newbie

Joined: Fri Mar 26, 2004 8:41 am
Posts: 9
Hi,

I've a Rubric class containing a set of Articles declared as lazy with:
Code:
<set
            name="articles"
            table="article_relrubrics"
            lazy="true"
            cascade="all"
            sort="unsorted"
>
  <key column="rubric"/>
  <many-to-many  class="myPackage.Article" column="article"/>
</set>


when I get a rubric, all contained articles are loaded as well (visible in the log):
Code:
   Session session = HibernateUtil.currentSession();
   Transaction tx = session.beginTransaction();
   Object o = session.get(Rubric.class, new Integer(1));
   tx.commit();
   HibernateUtil.closeSession();


I don't want the articles to be loaded if not requested to. Any idea what I'm doing wrong to have a lazy set?

Marc.


PS: I use Hibernate 2.1.3 with MySql 4.0.13


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 6:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I am sure you are accessing the collection in your code somehow.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 6:21 am 
Newbie

Joined: Fri Mar 26, 2004 8:41 am
Posts: 9
as far as I know, really not.
To understand what is going, I run the provided code from a test program that doesn't do anything else.

Marc.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 7:37 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
show your pojo source

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 10:02 am 
Newbie

Joined: Fri Mar 26, 2004 8:41 am
Posts: 9
Ok, you were rigth, I had a
Code:
      logger_.debug("setArticles: " + _articles);

in the setArticles method, and the toString method of the Set accesses to the Set elements forcing Hibernate to retrieve them from the db.
Thanks and sorry for the question.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 02, 2004 6:07 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Some nostalgia in your signature... come on Anthony!
Forget the past (nickname) and welcome the future ;-)

_________________
Emmanuel


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