I have a general table with the structure
Code:
code_fldname pk
code_value pk
code_cmmt
I have mapped this through a mapping of:
Code:
<class name="GeneralCode" table="code_mstr">
<composite-id name="key">
<key-property name="key" column="code_fldName" type="string"/>
<key-property name="value" column="code_value" type="string"/>
</composite-id>
<discriminator column="code_fldName" type="string" insert="false"/>
<subclass name="Segment" discriminator-value="jrg_segment">
<property name="name" type="string" column="code_cmmt"/>
</subclass>
</class>
Now I wish to have "Segment" mapped as a many-to-one relationship on another entity where the discriminator column is not stored in the given table, i.e.
Code:
<many-to-one name="segment" class="com.johnsands.lineplan.Segment"
lazy="false" insert="false" update="false">
<!-- I'm not sure what to put here for the first column in the composite id. -->
<!-- jrg_segment is the column within the given table I'm trying to map from (the second key in the composite-id). -->
<column name="jrg_segment"/>
</many-to-one>