Castor proposed enhancement for self-referential
JDO relationships.
Add the parent-key attribute which would indicate
the parent key for an object.
Example.
Class A --> Class B
Class A has a one-to-many relationship with Class B.
Class B has self-referential relationship
<class name="A" identity="aId" >
:
<field name="bs" type="B" collection="arraylist" >
<sql
many-key="a_id" parent-key="parent_b_id" />
</field>
</class>
<class name="B" identity="aId" >
:
<field name="bs" type="B" collection="arraylist" >
<sql
many-key="parent_b_id" />
</field>
</class>
In the above example Class A uses the following query to load Class B
objects:
select parent from b where where aId = $1 and parent_b_id IS
NULL
A parent_b_id of NULL indicates a top level parent.
Also relax the rule for dependent objects. The check isn't performed
for self-referential relationships.
I will gladly added the enhancement if it makes sense.
Steve
|
- Re: [castor-dev] JDO self-referential enhancement Stephen Ince
- Re: [castor-dev] JDO self-referential enhancement Bruce Snyder