db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg von Frantzius <joerg.von.frantz...@artnology.com>
Subject Re: JDO2 §12.7.2: fetch-depth only for "recursive fetch group references"?
Date Wed, 28 Sep 2005 10:29:00 GMT
[resending this because I haven't seen it coming back from jdo-dev@db.apache.org]

Hi Andy,

I'm seeing some problems with this current JPOX approach to fetch-depth,
and I hope I can make them understandable.

Andy Jefferson schrieb:

>>I read the spec that a self-referencing relationship (meaning the field
>>type is the same class that declares the field) is a good use case for
>>the fetch-depth attribute. But I think the use of fetch-depth is not
>>restricted to self-referencing relationships. Am I wrong here?
>I agree. I interpret fetch-depth as being for "recursive references" (as the 
>spec says). This encompasses
>1. self-referencing (A->A->A->... )
>2. circular-referencing (e.g A->B->C->A->B->C->.....)

With fetch-depth=1, how do you discover the circularity while obeying
the fetch-depth? (if the associations are all 1:n, you can't fetch the
whole path in one go, you'd need more than one fetch) And by the way, do
you mean circularity on class level or on object level (you don't do
static analysis of circles in the object model, do you?)

>This is what JPOX aims to support.
>The examples in the JDO2 spec are, incidentally, only of the self-referencing 

Apart from the above problem, this approach makes it really hard for the
user to predict what gets fetched. Just imagine case 2 without the
circle (no C->A): if the user wanted to detach an A object, with the
number of C objects reachable being really really huge. How could he
avoid detaching that A object without detaching a big number of C objects?

In my opinion things would be so much simpler if fetch-depth applied to
all kinds of fields, and the control over the size of the fetched object
graph would be much better.

Dipl.-Inf. Jörg von Frantzius  |            artnology GmbH
                                |                Milastr. 4
Tel +49 (0)30 4435 099 26      |              10437 Berlin
Fax +49 (0)30 4435 099 99      |  http://www.artnology.com

View raw message