-->
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.  [ 5 posts ] 
Author Message
 Post subject: Foreign Key Property
PostPosted: Fri Jan 16, 2004 6:49 am 
Newbie

Joined: Wed Dec 03, 2003 1:34 pm
Posts: 9
Suppose I have this:

<many-to-one
name="foo"
class="com.package.foo"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="foo_id" />

is there a way for Hibernate to get the actual value of the foo_id, rather than the foo object without also adding a seperate <property> for the foo_id value in the mapping file? I don't want to have to load the foo object just to get its id.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 6:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No. If there is no java property mapped to it, you can't get it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 6:53 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Note that you can proxy the foo class. Thus hibernate won't load foo if you just get id.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 6:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Or use a HQL query with projection to the ID. See http://www.hibernate.org/hib_docs/reference/html/query-language.html#query-language-s5


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 7:03 am 
Newbie

Joined: Wed Dec 03, 2003 1:34 pm
Posts: 9
Cheers.


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