-->
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: Hibenate session.get()
PostPosted: Thu Jul 29, 2010 5:35 pm 
Newbie

Joined: Thu Jul 29, 2010 5:24 pm
Posts: 5
I have a table X which has a foreign key reference to table y.
When I issue a session.get() on table X based on primary key, is there a way so that the all the contents of table Y is also retrieved along with table X.

In the table X hbm.xml file
there is a mapping for table Y

<many-to-one name="Y" class="com.efg.hibernate.Y" fetch="select">
<column name="FK" not-null="true" />
</many-to-one>

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Hibenate session.get()
PostPosted: Wed Aug 04, 2010 4:59 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Amy,
that option depends on the "fetch" option in your mapping file, if you want to define it at entity-level (meaning you won't be able to disable it).
Or you can do it dynamically using HQL "fetch join".

Please see the hibernate.org reference documentation for details, and use the correct forum: https://forum.hibernate.org/viewforum.php?f=1

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Hibenate session.get()
PostPosted: Tue Aug 10, 2010 6:45 pm 
Newbie

Joined: Thu Jul 29, 2010 5:24 pm
Posts: 5
Thanks Sanne.


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.