db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: JDO 2.1 review: recursion-depth
Date Thu, 13 Mar 2008 17:42:44 GMT
I think I've captured the consensus of this discussion:

12.7.4 Recursion Depth
For object models with bidirectional relationships or self-referencing  
relationships, it is useful to limit the depth of the object graph  
retrieved through these relationships recursively. The recursion-depth  
attribute of the field element is used for this purpose. The recursion- 
depth for a relationship field specifies the number of times an  
instance of the same class, subclass, or superclass can be fetched via  
traversing this field.
A value of negative 1 (or any negative value) means that the recursion- 
depth is not limited by traversing this field. If a field is defined  
in multiple fetch groups, the recursion-depth is the largest of the  
values specified, treating any negative number as a very large  
positive number. If not specified in any fetch group or in the base  
field definition, the default is 1. A value of 0 means that this field  
is not traversed at all, effectively removing the field from the fetch  
group.
For example, assume a class Directory with a field parent of type  
Directory and a field children of type Set<Directory>, and assume the  
recursion-depth of the parent field is set to negative 1 and the  
recursion-depth of the children field is set to 2. When a query for a  
Directory is executed, all parents of the selected Directory instances  
will be retrieved, and all of the parents’ parents until a parent is  
found with a null parent. Additionally, all children of the selected  
Directory will be retrieved and all children of the children of the  
selected Directory.

12.7.6
...
Recursive fetch group references are controlled by the recursion-depth  
attribute on a contained field or property element of a fetch-group. A  
recursion-depth of negative 1 (or any negative number) will fetch the  
whole graph of instances reachable from this field. A value of 0 means  
that this field is not traversed at all, effectively removing the  
field from the fetch group. The default is 1, meaning that only the  
instance directly reachable from this field is fetched.

Craig

On Mar 7, 2008, at 3:42 PM, Matthew T. Adams wrote:

> Yes, exactly.  This would be the no-op that I was referring to.
>
> -matthew
>
> ----- Original Message ----
> From: Michael Bouschen <mbo.tech@spree.de>
> To: jdo-dev@db.apache.org
> Cc: jdo-experts-ext@sun.com
> Sent: Friday, March 7, 2008 1:14:51 PM
> Subject: Re: JDO 2.1 review:  recursion-depth
>
>  Hi Matthew,
>
>  Yes, I remember that now.  I also remember never quite  
> understanding why 0 is an invalid value.  It seems to me that 0  
> would result in a no-op as far as recursion goes.  Why is that an  
> error?  It might be dumb, but I don't think it has to be an error.
>  Just for my understanding:
> you propose a recursion-depth of 0 means the corresponding field is  
> notfetched at all, correct? This would mean it is treated as if the  
> fieldwas not included in the fetch-group.
>
> Regards Michael
>
>  ----- Original Message ----
> From: Andy Jefferson <andy@jpox.org>
> To: jdo-experts-ext@sun.com
> Cc: jdo-dev@db.apache.org
> Sent: Wednesday, March 5, 2008 9:54:57 AM
> Subject: Re: JDO 2.1 review:  recursion-depth
>
>
>    I
> think
> it
> would
> be
> helpful
> to
> add
> the
> description
> of
> a
> recursion-depth
>    value
> of
> zero
> to
> section
> 12.7.4.
> Values
> -1
> and
> 1
> are
> discussed,
> but
> the
>    subsequent
> example
> uses
> a
> value
> of
> zero,
> which
> is
> special
> enough
> a
> value
> to
>    be
> called
> out
> explicitly.
>
> Well
> I'd
> just
> fix
> the
> example
> :-).
> A
> value
> of
> 0
> is
> invalid
> isn't
> it?
> -1
> is
> unlimited,
> and
> a
> positive
> integer
> is
> a
> finite
> number
> of
> levels.
> That's
> all
> we
> can
> have.
> I
> think
> 0
> used
> to
> represent
> infinite
> levels
> some
> time
> back
> but
> was
> changed
> to
> -1
> see
> item
> 22
> in
> the
> Changelog
> http://jcp.org/aboutJava/communityprocess/maintenance/jsr243/243ChangeLog.html
>
>
>
>
> -- 
> Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
> Buelowstr. 66                Fax.: +49/(0)30/217 520-12
> 10783 Berlin                 mailto:mbo.tech@spree.de
>
> Geschaeftsfuehrung: Martin Weber
> Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52
>
>
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message