datanucleus-core
datanucleus-core copied to clipboard
FetchPlan - support field.field, field#element.field, field#key.field, field#value.field syntax
The JDO2 spec defines the ability to specify fetch groups using field specs including field1.field2 field1.field2.field3 field1#element field1#element.field3
This is low priority since the same can be achieved by specifying fetch groups for each of the classes concerned.
An example
class A
{
B b;
}
class B
{
C c;
}
and we want to have a fetch group that loads up A.b, and B.c. With the above syntax we would add this for class A
<fetch-group name="group1">
<field name="b"/>
<field name="b.c"/>"
</fetch-group>
however you could easily do (class A)
<fetch-group name="group1">
<field name="b"/>
</fetch-group>
(class B)
<fetch-group name="group1">
<field name="c"/>
</fetch-group>
Work required to complete this :-
- Update AbstractPropertyMetaData so that it if a field name of "a.b" is specified it doesnt just put the name as "b".
- Update FetchGroupMetaData.initialise() so that when encountering a field name specification as above, it finds the class that the field refers to and adds a fetch group of the same name over there (recursive).
This "feature" also, in principle, means that if we have A.B and A.C.B then the "B" could be loaded differently based on the place in the object graph. This would mean a major tear up of FetchPlan handling, and for little usage. That aspect is consequently not of interest