-->
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: Using non-physical relationship
PostPosted: Tue Jan 04, 2005 4:07 pm 
Beginner
Beginner

Joined: Thu Jul 29, 2004 7:14 pm
Posts: 41
Hibernate version: 2.17

Hi guys,

I have 5 tables 'AREA', 'LOCATION', 'LANGUAGE', 'TABLELIST' and 'TRANSLATION'. The TABLELIST table is used to define tables in the system while the TRANSLATION table is used to store short_description and long_description for Areas (defined in AREA) and Locations (defined in LOCATION) w.r.t. language (defined in LANGUAGE).


The structure of AREA is :
areaId (java.lang.Integer) [Primary Key]
name (java.lang.String)

The structure of LOCATION is :
locationId (java.lang.Integer) [Primary Key]
name (java.lang.String)

The structure of LANGUAGE is :
languageId (java.lang.Integer) [Primary Key]
name (java.lang.String)

The structure of TABLELIST is :
tableId (java.lang.Integer) [Primary Key]
name (java.lang.String)

The structure of TRANSLATION is :
translationId (java.lang.Integer) [Primary Key]
languageId (java.lang.Integer) [Foreign Key to LANGAUGE table]
tableId (java.lang.Integer) [Foreign Key to TABLELIST table]
shortDescription (java.lang.String)
longDescription (java.lang.String)



There is no foreign key relationship between "AREA and TRANSLATION" and "LOCATION and TRANSLATION". My question is how to desgin the mapping files and POJOs for AREA, LOCATION and TRANSLATION so that when I retreive a particular Location, I retrieve all its translations as well.

I can see that I can use a Set to designate the associations in both AREA and LOCATION classes.

public class Area {
areaId java.lang.Integer;
name java.lang.String;
Set translations;

}

The Set "translations" will map to collections of TRANSLATION class. My question is how to define it in the mapping file?

Thanks


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.