hi there, i have a tiny problem with correct 1:n mappings in hibernate. E.g. I have two tables, one table containing languagedescriptors in certain languages for "*_mldID" keys, which are stored in tables containing data which has to be shown in certain languages within the application.
e.g.
TABLE roles containing the following fields
roleID
roleName_mldID (Name of Role: is a unique ID for a set of language descriptors for roleName in the languagedescriptors Table)
roleFunction_mldID (Function of Role: is a unique ID for a set of language descriptors for roleFunction in the languagedescriptors Table)
TABLE languagedescriptors containing the following fields
languageDescriptorID (that's what the _mldID's point to)
languageID (the language of the languagedescriptor)
languageDescriptorValue (the value of the languagedescriptor)
e.g.
roleName_mldID = 2
|
|
2 | 1 Benutzer (german language, languageID=1)
2 | 2 User (englisch language, languageID=2)
roleFunction_mldID = 3
|
|
2 | 1 ein Internet-Benutzer(german language, languageID=1)
2 | 2 an internet user (englisch language, languageID=2)
the languageDescriptorID is referenced by the _mldID fields in the roles Table. I dont know how to get hibernate to understand that (in this case) there are two different 1:n mappings coming from the roles table referencing sets of descriptors in the languagedescriptors table.
the part of Roles.hbm.xml i'm currently using which dont work :( is:
<set
name="roleName_mlds"
lazy="true"
table="LanguageDescriptors">
<key column="languageDescriptorID"/>
<one-to-many class="net.someproject.LanguageDescriptorData"/>
</set>
i dont know where to tell hibernate that it has to use the roleName_mldID as key for its mapping and not the PK of the table Roles
Help !!!
|