I have been working with inheritance a lot lately but finally I had to
remove it from my model.
If Base is an abstract class you will have problems at deleting A o Base
child objects.
Anyway in your case you want to make 3 relationships, A<-Base A->Base1
A->Base2 (the arrows are not for cardinality just to tell where do you
want to model the relationships) this will render some warnings or
notices in the modeller, but will work ok with your current usage.
El 13/01/2013 13:46, emeka okafor escribió:
Hello again,
I have been trying to simplify some parts of my code and so I figured the
following will work:
I have a many-to-many relation, say A <<->> Base
Base has two subclasses, say Base1 andBase2 modeled using single table
inheritance,
so basically:
<obj-entity name="Base1" superEntityName="Base" className="Base1">
<qualifier><![CDATA[Type = "BASE1"]]></qualifier>
</obj-entity>
<db-relationship name="bases" source="A" target="Base" toMany="true">
<db-attribute-pair source="A_ID" target="BASE_ID"/>
</db-relationship>
I thought that by adding this:
<obj-relationship name="bases1" source="A" target="Base1"
db-relationship-path="bases"/>,
in other words: A -> B1,
Then I would be able to do A.getBases1() to retrieve all of my subclasses
instead of always having to go through A.getBases() and then filter using the
discriminator column.
But it is not working. Any idea how to achieve what I am trying to do?
Thanks.