-->
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.  [ 1 post ] 
Author Message
 Post subject: One-to-Many in a class having composite primary key
PostPosted: Sat Feb 16, 2008 8:31 am 
Newbie

Joined: Sat Feb 16, 2008 8:12 am
Posts: 1
Location: India
Hi,
Iam having a table which is having three fields.
Table name: REGION_AUCTION
composite primary key: auction_id + region_id + auction_loc
one more column named: auc_rep_id --> mapped to user_id in USERS table.

This table is refering to another table(Users).
Table name : USERS
primary key: user_id

And there is One-to-Many relationship between REGION_AUCTION and USERS.

Here iam getting a MappingException saying that "Foriegn Key(user_id) must be defined for the referenced primary key(auction_id,region_id,auction_loc)"

My question is how can i write a <set> tag in REGION_AUCTION.hbm.xml to refer USERS table and a corresponding <many-to-one> tag in USERS.hbm.xml

Please help me out to resolve this problem. Thanks in advance...

_________________
Regards
Pcnarra


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.