Hello,
I have something like this:
Code:
<class [b]name="A"[/b] table="[b]tableA[/b]" discriminator-value="0" [b]entity-name="A"[/b]>
<id name="id" unsaved-value="null" type="int">
<generator class="native"/>
</id>
<discriminator column="someid" type="int" />
<property name="..." />
...
<subclass [b]entity-name="AA"[/b] [b]name="AA"[/b] discriminator-value="1">
</subclass>
<subclass entity-name="AB" name="AB" discriminator-value="2">
</subclass>
....
</class>
<class [b]name="A"[/b] table="[b]tableB[/b]" discriminator-value="0" [b]entity-name="order_A"[/b]>
<id name="id" unsaved-value="null" type="int">
<generator class="native"/>
</id>
<discriminator column="someid" type="int" />
<property name="..." />
...
<subclass [b]entity-name="order_AA"[/b] [b]name="AA"[/b] discriminator-value="1">
</subclass>
<subclass entity-name="order_AB" name="AB" discriminator-value="2">
</subclass>
....
</class>
<class name="Z1" table="tableZ1">
....
<set name="someset" ... [b]cascade="save-update"[/b]>
...
<many-to-many column="..." entity-name="A"/>
</set>
...
</class>
<class name="Z2" table="tableZ2">
....
<set name="someset" ... [b]cascade="save-update"[/b]>
...
<many-to-many column="..." entity-name="order_A"/>
</set>
...
</class>
class Z1 {
Set<A> someset;
}
class Z2 {
Set<A> someset;
}
class A { ... }
class AA extend A { ... }
class AB extend A { ... }
More info:
Classes Z1 and Z2 contain sets with AA, AB, etc but those classes are linked with two different tables (normal and ordered_normal).
Problem:
I try to save Z1 and Z2 and:
- Z1 and all objects from set save ok (
normal table)
- Z2 save ok but objects from set save in wrong table -
normal table instead of
ordered_normal table
I think it should be problem with cascade. Any ideas how to solve this? Any "magical" switch?
Regards
Stefan