-->
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: Problem of Exclusive Relationship Mapping
PostPosted: Sat Apr 22, 2006 1:22 pm 
Newbie

Joined: Sat Apr 22, 2006 1:04 pm
Posts: 1
Location: Hong Kong
Hi All,
I got a very special case on mapping my objects. I do not know how to map them, any buddy know how to map such situation? Thanks.

FoodItem table
==========
foodid (PK)
foodname

SetMeal table
==========
setmealid (PK)
setmealname

Price
==========
priceid (PK)
referno (foodid or setmealid)
type (the type of the referno - FoodItem/SetMeal )
amount
startdate
enddate

FoodItem 1 to N Price
SetMeal 1 to N Price

Is there any way that I can retrieve a FoodItem with its Price by referno and type in Price, also for SetMeal. I do not know how can I retrieve a one-to-many relationship that depends on the Object type (eg: FoodItem) with its key in Price, so that after I get a FoodItem, there is a Collection in FoodItem which is storing the Price of that FoodItem.

ps: I am using Hibernate 2.x version


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.