Hi all,
I've a db table with a composite primary key formed by 4 fields: 3 are string and 1 is an integer.
The 3 textual fields are manually inserted by the user, but the integer field is calculated using a complex algorithm (don't ask me why... :-\).
At the moment the composite key is mapped as follows:
Code:
<composite-id name="id" class="MyCompositeKeyClass">
<key-property name="fieldTxt1" type="string">
<column name="fieldTxt1" sql-type="char(5)" unique="false" not-null="false" />
</key-property>
<key-property name="fieldTxt2" type="string">
<column name="fieldTxt3" sql-type="char(1)" unique="false" not-null="false" />
</key-property>
<key-property name="fieldInt" type="int">
<column name="fieldInt" sql-type="integer(9)" unique="false" not-null="false" default="0" />
</key-property>
<key-property name="fieldTxt3" type="string">
<column name="fieldTxt3" sql-type="char(2)" unique="false" not-null="false" />
</key-property>
</composite-id>
Is it possible (and how) to create a generator class to calculate the value for the integer field?
The <generator> tag is only available in the <id> tag and not in the </composite-id> tag.