Scott,
Parent-child relationship is one-to-many, so no join table is needed.
Just create a relationship to itself. Here is an example of what you
described:
<?xml version="1.0" encoding="utf-8"?>
<data-map project-version="1.1">
<db-entity name="NODE">
<db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true"/>
<db-attribute name="NAME" type="VARCHAR" length="100"/>
<db-attribute name="PARENT_ID" type="INTEGER"/>
</db-entity>
<obj-entity name="Node" className="Node" dbEntityName="NODE">
<obj-attribute name="name" type="java.lang.String" db-
attribute-path="NAME"/>
</obj-entity>
<db-relationship name="children" source="NODE" target="NODE"
toMany="true">
<db-attribute-pair source="ID" target="PARENT_ID"/>
</db-relationship>
<db-relationship name="parent" source="NODE" target="NODE"
toMany="false">
<db-attribute-pair source="PARENT_ID" target="ID"/>
</db-relationship>
<obj-relationship name="children" source="Node" target="Node" db-
relationship-path="children"/>
<obj-relationship name="parent" source="Node" target="Node" db-
relationship-path="parent"/>
</data-map>
Andrus
On Jun 11, 2005, at 10:37 AM, Scott Tran wrote:
> I'm trying to generate a data object along the lines
> of
>
> class Node {
>
> String name;
> Node parent;
> List<Node> children;
> }
>
> I tried to use a join table...but none of the examples
> I looked at used a join table, so I'm not sure if I'm
> doing it right... When I try to generate the java
> class it complains about ObjRelationship has
> incomplete DbRelationship mapping. Any suggestions?
>
>
> Thanks,
> Scott
This archive was generated by hypermail 2.0.0 : Sat Jun 11 2005 - 11:44:04 EDT