-->
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: Lazy Initialization: many-to-one
PostPosted: Sat Oct 18, 2003 3:44 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
When I have a one-to-many relationship, I can mark a collection as lazy=true, then the collection will not be automatically populated when the object containing the collection is retrieved from the database.

but, if I have a many-to-one relationship ?

Code:
<class name="hibernate.PlayerVO" table="PLAYER">
    <id name="id" column="player_id" type="long" unsaved-value="null">
      <generator class="sequence"/>
    </id>

<many-to-one name="team" class="hibernate.TeamVO" column="team_id" />

</class>


When I retrieve the "Player", the "Team" will be automatically populated!

Can I do a "Lazy Initialization" for a many-to-one relationship?

thanks

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 18, 2003 5:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
sure, define Team to use a proxy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 18, 2003 7:11 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
steve wrote:
sure, define Team to use a proxy


that is the problem! :-(

I

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 18, 2003 8:18 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
I found this post
http://forum.hibernate.org/viewtopic.ph ... ight=proxy

and now I understood,

Thanks for the tip!

_________________
Ricardo Lecheta


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.