Hibernate version: 3.0beta4
Hi,
i'd like use hibernate on an exsiting schema (that i can't modify). I have several tables (be A and B) and a special table containing some labels.
The primary key of A is a long.
The primary key of B is a string.
So the description of my labels table is:
foreign_key: string
type: string ('A' or 'B' or other for other tables)
locale: string (iso code... great idea to support natively this type in hibernate)
label: my label in the specified locale for the specified (type) object.
So, each of my objects A and B have a map of labels (key of map is the locale). I don't find how map this schema. Any idea ?
How specify:
- the type in the mapping file ? (or by another way ?)
- convert the key ?
Code:
<class name="A" table="table_a">
<id name="id" column="id" type="long" unsaved-value="null">
<generator class="increment"/>
</id>
<!-- snip properties -->
<map name="labels" table="x_label" lazy="false">
<key not-null="true">
<column name="lbl_id"/>
<!--<column name="lbl_type" formula="'A'"/>-->
</key>
<map-key column="loc_id" type="locale"/>
<element column="lbl_value" type="string"/>
</map>
</class>