-->
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.  [ 2 posts ] 
Author Message
 Post subject: many-to-one with lazy loading
PostPosted: Fri Dec 12, 2003 6:46 am 
Newbie

Joined: Tue Dec 09, 2003 1:59 pm
Posts: 5
Hello everyone,

Is there any way of mapping a many-to-one relationship as lazy without using a proxy for the related class?

My motivation is:
1. I have a class with many many-to-one relationships
2. I usually work with only one of those at a time
3. The related classes are also used alone (e.g. I use find() and HQL to query those classes)
4. I don't want an SQL query for each instance of the related classes when finding for a list of instances (and that's what I get when I do a find() over a class with a proxy).

I've read in the documentation (I don't remember exactly where) that find() is supposed to NOT use proxies, but it uses proxies in my tests.

I'm using Hibernate 2.0, and my class doesn't have any special thing (a class mapped with proxy attribute to itself):

Code:
<class name="Person" table="PERSON" proxy="Person" >
  <id name="id" type="string" >
    <column name="PERSON_ID"/>
    <generator class="assigned"/>
  </id>
  (...)
</class>


Am I missing something? Is there a better solution I havn't seen?

Thanks in advance,

Jordi Pradel


Top
 Profile  
 
 Post subject: Re: many-to-one with lazy loading
PostPosted: Fri Dec 12, 2003 8:49 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
jpradel wrote:
Is there any way of mapping a many-to-one relationship as lazy without using a proxy for the related class?

None that I know, but I would be a cool feature.

_________________
Emmanuel


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