You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Didier Schlegel <di...@triangulum-ag.com> on 2006/03/30 16:09:27 UTC

Fetching concept

Hello everybody,

I have a concern about the current fetch-depth concept, maybe I'm just 
missunderstanding and don't see all the possiblilities.

The way an object graph is fetched can only be defined with the maximum 
fetch-depth and the class's fetch-groups (and the fetch-size). This 
means that every instance of a certain class appearing in that fetched 
object graph will have exacly the same fields loaded. In certain cases 
it is needed that instances of a same class should be loaded differently.
I think with the 'old'  fetch-depth concept this was possible as the 
depth and fetch-group could be redefined for every field.

<class name="MyClass" detachable="true">
    <inheritance strategy="new-table"/>
    <field name="longPath"         persistence-modifier="persistent" 
        default-fetch-group="false"/>
    </field>
    <field name="shortPath"         persistence-modifier="persistent" 
        default-fetch-group="false"/>
    </field>
    <fetch-group name="myFetchGroup">
        <field name="longPath" fetch-depth="5" fetch-group="long"/>
        <field name="shortPath" fetch-depth="2" fetch-group="short"/>
    </fetch-group>
</class>
<class name="Path" detachable="true">
    <...>
    <fetch-group name="long">
       <...>
    </fetch-group>
    <fetch-group name="short">
       <...>
    </fetch-group>
</class>

Is this supported by the new fetching concept? If not, will it be or is 
there a workaround?

Thank you!
Didier