-->
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: Virtual "one - to - one" mapping
PostPosted: Thu Jun 23, 2005 6:10 am 
Beginner
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


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.