i have classes like:
class X{
map<AB, Y> ABs;
map<AC, Y> ACs;
}
class Y{
string info
}
class A {
map <X, Y> Xs;
}
class AB estends A{
string info2
}
class AC extends A{
integer amount;
}
with mapping
for X:
<id ... column="X_id"...>
<map name="ABs" inverse="true">
<key column="X_id" not-null="true"/>
<map-key-many-to-many column="A_id" class="AB" />
<one-to-many class="Y"/>
</map>
<map name="ACs" inverse="true">
<key column="X_id" not-null="true"/>
<map-key-many-to-many column="A_id" class="AC" />
<one-to-many class="Y"/>
</map>
for Y
<id ... column="Y_id"...>
.....
for A, AB and AC
<class name="A"....>
<id... column="A_id"..>
<map name="Xs">
<key column="A_id" not-null="true"/>
<map-key-many-to-many column="X_id" class="X" />
<one-to-many class="Y"/>
</map>
<union-subclass name="AB".....>
.....
</union-subclass>
<union-subclass name="AC".....>
.....
</union-subclass>
</class>
Let x be an object of class X, a of class A and so on.
When I add x to Xs of some ab, and the same x to Xs of some ac, then both ABs and ACs of x have 2 elements (should be 1), and when i try to use them i got row not found exception for one of those 2 elements in each map.
How to cope with that? i tried to add not-found="ignore" in <map-key-many-to-many> but UNFORTUNATELY it is not supported there (while its supported in many-to-many), experimented witch fetches and some other things but it didnt work. What should I do to make it work?
I have to have Xs map in A
Thank you in advance for help
|