How to use a discrimator right?
I have a stranger problem with using discriminators.
I was reading that you have to additionaly set the where-clause to the right type (discriminator value).
The problem is here that many-to-one does not provide the where-clause!!!
I was searching on the internet and was reading this article:
http://jroller.com/eyallupu/entry/getti ... en_mappingSetting Forcing on true did not either help.
Code:
<class="A" abstract="true" table="A">
<id name="A_ID"> ....... </id>
<discriminator
column="Typ"
type="string"
length="1"
not-null="false"
force="true"
/>
<property name="name" type="string" />
<subclass name="SA" extends="A" discriminator-value="S" >
</subclass>
<subclass name="LA" extends="A" discriminator-value="L" >
</subclass>
</class>
Code:
<class name="B" table="B">
<id name="B_Id"> </id>
<!-- some stuff here -->
<idbag name="lcList" table="A_B" cascade="all, delete-orphan" >
<collection-id type="integer" column="A_B_ID">
<generator class="identity" />
</collection-id>
<key column="B_Id" />
<composite-element class="myObj">
<property name="level" column="level" type="string" length="1" not-null="false" />
<many-to-one name="la" class="LA" column="A_ID"/>
</composite-element>
</idbag>
</class>