Hi,
I'm having some difficulty getting many-many relationships to work w.r.t
my mapping file.
(This is perhaps made more complicated by the fact that I'm trying to
implement what amounts to the storage of a tree from a composite pattern
class structure, but I haven't been able to get far enough to find out if
that's a problem yet).
My mapping file is below.
If I include a type attribute for the many mapping that represents the
type of the db column, I get a mapping exception telling me (quite
rightly, I suppose) that I can't map my class to a string. If I leave the
type out (as below), I get an NPE.
I would really appreciate any advice,
tia
Owen
<mapping>
<!--Mapping for Destination classes.
Destinations employ a composite pattern which can be simulated using a
uranury many-many
relationship in the database.
-->
<!--ItemDestination represenets the leaf class-->
<class name="com.unique.deliver.dataobjects.ItemDestination"
identity="ID">
<cache-type type="count-limited" capacity="1000"/>
<map-to table="destinations"/>
<field name="ID" type="string">
<sql type="varchar" name="id"/>
</field>
<field name="name" type="string">
<sql name="name" type="varchar"/>
</field>
<field name="tag" type="string">
<sql type="varchar" name="tag"/>
</field>
<field name="parent" collection="collection"
type="com.unique.deliver.dataobjects.AbstractDestination"
set-method="addParent">
<sql name="parentid" many-key="childld"
many-table="destinationgroups"/>
</field>
</class>
<!--Destination group represents the Composite class. -->
<class name="com.unique.deliver.dataobjects.DestinationGroup"
identity="ID">
<cache-type type="count-limited" capacity="1000"/>
<map-to table="destinations"/>
<field name="ID" type="string">
<sql name="id" type="varchar"/>
</field>
<field name="name" type="string">
<sql name="name" type="varchar"/>
</field>
<field name="tag" type="string">
<sql name="tag" type="varchar"/>
</field>
<field name="children" collection="collection"
type="com.unique.deliver.dataobjects.AbstractDestination"
set-method="addChild">
<sql name="childid" many-table="destinationgroups"
many-key="parentid"/>
</field>
</class>
</mapping>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev