Hi Filip,
> <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"/>
The way relationships above are mapped you'll be getting GRANDchildren
and GRANDparents. Is this really what you want? The query you quote
seems correct (for grandchildren). What I mean is that
> 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]
is a short form for
SELECT t0.description, t0.id, t0.parent_id
FROM dbo.IMV_locations t0, dbo.IMV_locations t1, dbo.IMV_locations t2
WHERE t0.parent_id = t1.id AND t1.parent_id = t2.id AND t2.id = ?
[bind: 1]
(see an extra join)... If you need direct children, then you need to
remove the last component in the obj-relationship path. The resulting
mapping should look like this:
<obj-relationship name="children" source="Location" target="Location"
deleteRule="Cascade"
db-relationship-path="rel_children"/>
<obj-relationship name="parent" source="Location" target="Location"
db-relationship-path="rel_parent"/>
I hope I understood your requirements correctly...
Andrus
This archive was generated by hypermail 2.0.0 : Sun Apr 24 2005 - 22:05:28 EDT