I'm trying to map a legacy system where there is effectively a perfectly reasonable joined-subclass situation, but the table for the subclass not only carries the primary key from the parent, but also has its own unique key which is generated from an oracle sequence generator.
How might I map an extra property (column) to get get the next val from a sequence generator on insert?
I had hoped to use something like this, but it doesn't work:
<joined-subclass name="Color" table="COLOR">
<key column="PARENT_ID" />
<property name="brand" column="BRAND" />
<property name="secondKey" column="SECOND_KEY">
<generator class="sequence">
<param name="sequence">PARENT_GEN</param>
</generator>
</property>
</joined-subclass>
Yes, the second key is useless and should not be there. However, it is, and can't go away without breaking the old code.
|