db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Didier Schlegel <didier.schle...@freesurf.ch>
Subject new fetch-depth concept
Date Mon, 27 Mar 2006 13:02:03 GMT
Hello,

I'd like to upgrade to jdo-2.0-rc-1 (from jpox-beta-6 to jpox-rc-1).

I have the situation where objects of the same type must be loaded with 
different fetch-depths in a same object graph.

The metadata looks like the following (with fetch-depth declarations):

<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"/>
		<field name="shortPath" fetch-depth="2"/>
	</fetch-group>
</class>

longPath and shortPath are instances of the same type.

It seems that this is not possible anymore...

I might get it as follows:

fetchPlan.addFetchGroup("myFetchGroup");
fetchPlan.setMaxFetchDepth(1);
MyClass root = pm.detachCopy(pm.getObjectById(oid));
fetchPlan.setMaxFetchDepth(5);
root.setLongPath(pm.detachCopy(pm.getObjectById(pm.getObjectId(root.getLongPath()));
fetchPlan.setMaxFetchDepth(2);
root.setShortPath(pm.detachCopy(pm.getObjectById(pm.getObjectId(root.getShortPath()));

But I would end up with a detached-dirty instance...

thanks for your help!
Didier


Mime
View raw message