Hibernate version: 3.0
Name and version of the database you are using: Oracle 9
Hello
I am new to Hibernate. Suppose three tables:
business_case,
message and
language. Each business case has title and description. Both title and description are translated to all supported languages listed in table
language. Theese translations are stored in
message table.
Code:
TABLE: language
COLUMNS: language_id, name
PRIMARY KEY: language_id
TABLE: message
COLUMNS: language_id, key, value
PRIMARY KEY: language_id, key
FOREIGN KEY: language_id
TABLE: business_case
COLUMNS: business_case_id, title_key_id, description_key_id, ...
PRIMARY KEY: business_case_id
I've already mapped table
language to
message:
Code:
<class name="Message" table="MESSAGE">
<composite-id>
<key-many-to-one name="language" column="LANGUAGE_ID" class="Language" />
<key-property name="key" column="KEY" />
</composite-id>
<property name="value" column="VALUE" length="255" not-null="true" />
</class>
Please help me how to map
business_case to
message. title_key_id and description_key_id in
business_case should refer to
message. Link to correct documentation anchor is sufficient.
Thanks in advance
Martin