Here's an example:to explain what I mean:
class A {
private D parent;
...
}
class B extends A {...}
class C extends A {...}
class D {
private Collection entries; // of A or B or C
}/// mapping.xml ///
<mapping>
<class name="A" identity="id" key-generator="HIGH-LOW">
<map-to table="TA" />
<cache-type type="none" />
<field name="id" type="java.lang.Long" >
<sql name="ID" type="bigint" />
</field>
<field name="name" type="java.lang.String" >
<sql name="NAME" type="char" />
</field>
<field name="parent" type="D">
<sql name="PARENTID" />
</field>
</class> <class name="B" extends="A" identity="id" key-generator="HIGH-LOW">
<map-to table="TB" />
<cache-type type="none" />
<field name="id" type="java.lang.Long" >
<sql name="ID" type="bigint" />
</field>
</class>
<class name="C" extends="A" identity="id" key-generator="HIGH-LOW">
<map-to table="TC" />
<cache-type type="none" />
<field name="id" type="java.lang.Long" >
<sql name="ID" type="bigint" />
</field>
</class>
<class name="D" identity="id" key-generator="HIGH-LOW">
<map-to table="TD" />
<cache-type type="none" />
<field name="id" type="java.lang.Long">
<sql name="ID" type="bigint" />
</field>
<field name="entries" type="A" collection="collection" lazy="true">
<sql many-key="PARENTID" />
</field>
</class>
</mapping>Assume there are 1 record in table TB and 1 record in TC. So there must be 2 records in TA.
When loading an instance of D and accessing its field "entries"
~ Do I get a Collection of 2 objects?
~ Is one of theese objects instaneceof B and one instanceof C or are they both just instanceof A?
Regards, Michael
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
