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
|