You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by David Wisneski <wi...@gmail.com> on 2006/09/07 20:15:28 UTC

question on FetchGroup

The preview documentation says that fetch group depth=0 is the default and
that depth=0 will recurse until the graph is exhausted.

The actual name on the @FetchGroup annotation seems to be "recusionDepth"
not "depth".  However the behavior seems that it only supports
recursionDepth=1
and setting it to any other value such is ignored.

For example we have an org chart application where a Department can
recursively report to higher departments.  I don't want to the make the
Department.reportsTo relationship EAGER, because I don't want to
bring in higher departments all the time in my application.  However
I do need to do a few queries where I bring in all higher departments and
I thought I could do defining a fetch group with "reportsTo" and a depth=0
and then adding that fetch group to the OpenJPAQuery.

But that does not seem to work.  Is this a code bug or is a document error?

Or an error in my understanding of FetchGroup depth ?

RE: question on FetchGroup

Posted by Pinaki Poddar <pp...@bea.com>.
MaxFetchDepth is the upper limit of the number of relations traversed to
reach a node in the graph from the root object node. By default, it is
set to 1. -1 means infinte.
RecursionDepth controls the number of times a particular relation would
be traveresed in case of self-relation. Say Male has a relation field
"father" to another Male. If recusrion-depth is set to 3 for "father" --
a Male instance will also fetch his father, grandfather and
great-grandfather.   

A single depth being fetched irrespective of recursionDepth setting is
perhaps because maxFetchDepth is set to 1.      


Pinaki Poddar
BEA Systems
415.402.7317  


-----Original Message-----
From: David Wisneski [mailto:wisneskid@gmail.com] 
Sent: Thursday, September 07, 2006 11:19 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: question on FetchGroup

By "not working" I meant that irregardless of what value for
recursionDepth was specified ( we tried 0, 1, 2  ) only one level was
retrieved.  However we did not try changing the MaxFetchDepth property.

On 9/7/06, Abe White <aw...@bea.com> wrote:
>
> > But that does not seem to work.  Is this a code bug or is a document

> > error?
> >
> > Or an error in my understanding of FetchGroup depth ?
>
> Both a documentation error and a misunderstanding.  I'll try to update

> the docs later today.  In the meantime, I don't know what you mean 
> when you say it "does not seem to work", but one important note is 
> that the MaxFetchDepth is 1 by default, so if you want to fetch deep 
> relations, you'll need to increase that -- either on the FetchPlan or 
> using the openjpa.MaxFetchDepth configuration property.
> ______________________________________________________________________
> _
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: question on FetchGroup

Posted by David Wisneski <wi...@gmail.com>.
By "not working" I meant that irregardless of what value for recursionDepth
was specified ( we tried 0, 1, 2  ) only one level was retrieved.  However
we did not try changing the MaxFetchDepth property.

On 9/7/06, Abe White <aw...@bea.com> wrote:
>
> > But that does not seem to work.  Is this a code bug or is a
> > document error?
> >
> > Or an error in my understanding of FetchGroup depth ?
>
> Both a documentation error and a misunderstanding.  I'll try to
> update the docs later today.  In the meantime, I don't know what you
> mean when you say it "does not seem to work", but one important note
> is that the MaxFetchDepth is 1 by default, so if you want to fetch
> deep relations, you'll need to increase that -- either on the
> FetchPlan or using the openjpa.MaxFetchDepth configuration property.
> _______________________________________________________________________
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>

Re: question on FetchGroup

Posted by Abe White <aw...@bea.com>.
> But that does not seem to work.  Is this a code bug or is a  
> document error?
>
> Or an error in my understanding of FetchGroup depth ?

Both a documentation error and a misunderstanding.  I'll try to  
update the docs later today.  In the meantime, I don't know what you  
mean when you say it "does not seem to work", but one important note  
is that the MaxFetchDepth is 1 by default, so if you want to fetch  
deep relations, you'll need to increase that -- either on the  
FetchPlan or using the openjpa.MaxFetchDepth configuration property.
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.