I've had the same problem with self referencing,
on my first try.
Your relation is upside-down
It needs a little strange thinking to get it right.
cayenne-use..bjectstyle.org schrieb am 22.04.05 00:35:02:
>
> I'm not sure if this has already been covered as
> there doesn't seem to be a search facility for the
> mailing list.
>
> My problem is that I have a simple hierarchy with
> locations. A location can have child locations and
> vice verca can have a parent:
>
> Schema:
> --------------
> id
> parent_id
> description
>
> Now I have modeled this relationship and the modeler
> generated the following:
>
> <db-entity name="IMV_locations" schema="dbo" catalog="GPSForecast">
> <db-attribute name="description" type="VARCHAR" length="75"/>
> <db-attribute name="id" type="INTEGER" isPrimaryKey="true"
> isMandatory="true" length="10"/>
> <db-attribute name="parent_id" type="INTEGER" length="10"/>
> </db-entity>
>
> <db-relationship name="rel_children" source="IMV_locations"
> target="IMV_locations" toMany="true">
> <db-attribute-pair source="id" target="parent_id"/>
> </db-relationship>
>
> <db-relationship name="rel_parent" source="IMV_locations"
> target="IMV_locations" toMany="false">
> <db-attribute-pair source="parent_id" target="id"/>
> </db-relationship>
>
> <obj-relationship name="children" source="Location" target="Location"
> deleteRule="Cascade"
> db-relationship-path="rel_children.rel_children"/>
>
> <obj-relationship name="parent" source="Location" target="Location"
> db-relationship-path="rel_parent.rel_parent"/>
>
> Now when I run some test code to build a tree in tapestry, the
> following statement gets genereated when I try to fetch children:
>
> SELECT t0.description, t0.id, t0.parent_id
> FROM dbo.IMV_locations t0, dbo.IMV_locations t1
> WHERE t0.parent_id = t1.id AND (t1.parent_id = ?) [bind: 1]
>
> This however incorrect, it should read:
>
> SELECT t0.description, t0.id, t0.parent_id
> FROM dbo.IMV_locations t0, dbo.IMV_locations t1
> WHERE t0.parent_id = t1.id AND (t1.id = ?) [bind: 1]
>
> Has anyone else had this problem?
> Filip
__________________________________________________________
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201
This archive was generated by hypermail 2.0.0 : Fri Apr 22 2005 - 05:37:01 EDT