-->
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: foreign key column
PostPosted: Wed Sep 14, 2005 1:33 pm 
Newbie

Joined: Fri Sep 09, 2005 11:11 am
Posts: 19
<class name="User" table="USERS">
<id name="id" column="ID"/>
<property name="tmpid" column="TMPID"/>
<set name="items" table="ITEMS">
<key column="ITEMID"/>
<element column="INFO" type="string"/>
</set>
</class>

=============================
If User.id = 4, then the resulting User Object has a collection of items object where each item object's ITEMID is equal to 4 as well.

What if the user object need to retrieve a collection of item objects where each item objects's ITEMID is equals to USERS.TMPID column, instead of the primary key column? It is possible?


I am very new to this hibnerate product. I am grateful for any info you can offer.

Thanks.
zollen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 2:04 pm 
Pro
Pro

Joined: Fri Sep 02, 2005 4:21 am
Posts: 206
Location: Vienna
Hi,

Yes it is possible in Hibernate 3.x - if TMPID is a unique index (AFAIK).

Look for property-ref in the documentation - and post again if you need more help (I think you'll learn more trying to find out yourself first...)

Erik


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.