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
|