Beginner |
|
Joined: Tue May 10, 2005 4:18 am Posts: 29
|
Hello All
I am (again) having a problem with mapping a legacy data to a hibernate class.
My "Info" class has an these properties
Int id;
String name;
Image mainImage;
id and name are mapped to the "Indo" table.
The class "Image" is mapped in the usual fashion to "Image" table - ID, description etc.
There is another table "rel_table" to manage the connection :
info_id
image_id
relation_type
Now - the main image for an "Info" object is the image with a specific relation_type :
info_id image_id relation_type
1 3 17
1 2 13
So the main Image to the info '1' is image '3' , because the relation 17 means "Main Image" relation.
My question is - How should I map the "Info" class so that its mainImage property will be mapped to the right image ?
Thank you in advance.
Elad
|
|