Hello all,
I'm currently experiencing problems mapping a bag inside a subclass which uses a discriminator.
This is my mapping:
Code:
<hibernate-mapping>
<class name="com.gerig.bo.settlement.Agreement" table="AGREEMENTS">
<id name="Id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">agreements_seq</param>
</generator>
</id>
<discriminator column="TYPE" type="string"/>
[...]
<subclass name="com.gerig.bo.settlement.LabelAgreement" discriminator-value="LabelAgreement">
<join table="LABEL_AGREEMENTS">
<key column="AGREEMENT_ID"/>
<property name="AgreementMode" column="AGREEMENT_MODE"/>
</join>
<bag name="Recordings" cascade="none" inverse="false" table="LABEL_AGREEMENTS_RECORDINGS" lazy="false">
<key column="AGREEMENT_ID" />
<many-to-many column="RECORDING_ID" class="com.gerig.bo.label.Recording"/>
</bag>
<bag name="Productions" cascade="none" inverse="false" table="LABEL_AGREEMENTS_PRODUCTIONS" lazy="false">
<key column="AGREEMENT_ID" />
<many-to-many column="PRODUCTION_ID" class="com.gerig.bo.label.Production"/>
</bag>
</subclass>
</class>
</hibernate-mapping>
The combination of <bag> and <subclass> elements leads to the following error:
Code:
The content of element type "subclass" must match
"(meta*,tuplizer*,synchronize*,(property|many-to-one|one-to-one|
component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-
array)*,join*,subclass*,loader?,sql-insert?,sql-update?,sql-delete?,resultset*,
(query|sql-query)*)".
Using <joined-subclass> will circumvent the issue, however, I need to use the discriminator value from the parent table.
I'd be grateful for any hints.
Would it maybe help to create a property for the type property and modify the getType() method to return class.getCanonicalName() ?
Best regards
Marcus