Hi,

best, you have a look at the documentation:

http://people.apache.org/~mprudhom/openjpa/site/openjpa-project/manual/ref_guide_pc_enhance.html

OpenJPA classes need to be enhanced to provide lazy fetching. Else there will 
always been used eager fetching, which could be the cause of your problem.

-------- Original-Nachricht --------
> Datum: Fri, 15 May 2009 15:26:43 +0200
> Von: "Morten O. Hansen" <morte...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Creating nodes with parents

> Hi
> 
> Thank for your quick response :) Sorry for my ignorance, but what do you
> mean by enhancing the classes?
> 
> //Morten
> 
> On Fri, May 15, 2009 at 15:21, <naomi-...@gmx.de> wrote:
> 
> > Hi,
> >
> > as far as I know, TopLink has a maximum fetching depth of 2 by default
> and
> > OpenJPA has an infinite fetching depth, which could lead to recursions
> in
> > the worst case if you use eager fetching.
> > I am wondering why this also happens with lazy fetching - did you forget
> to
> > enhance your classes?
> >
> > You can set the maximum fetching depth in your persistence.xml by
> setting
> > the following property:
> >
> > <property name="openjpa.MaxFetchDepth" value="2"/>
> >
> > I hope this helps :)
> >
> > -------- Original-Nachricht --------
> > > Datum: Fri, 15 May 2009 14:58:03 +0200
> > > Von: "Morten O. Hansen" <morte...@gmail.com>
> > > An: users@openjpa.apache.org
> > > Betreff: Creating nodes with parents
> >
> > > Hi all
> > >
> > > I'm trying to create a Node class, where every Node has a pointer to a
> > > parent Node (or null if there is none).
> > >
> > > A simplified view of the Node-class looks like this:
> > >
> > > @Entity
> > > public class Node {
> > >   @Id protected long id;
> > >   @ManyToOne(fetch=LAZY)
> > >   protected Node parent;
> > >   protected String name;
> > >   protected String displayName;
> > >
> > > // setters / getters..
> > > }
> > >
> > > And this was working correctly in TopLink (I think they just do
> infinite
> > > recursion depth), but in OpenJPA i get something that looks like
> > recursion
> > > errors.
> > >
> > > Is there a better way of doing this? I have implemented a hack just
> using
> > > long parentId instead, but that kinda sucks when you are deleting and
> > > updating nodes.
> > >
> > > I know there is something called FetchGroups in OpenJPA, but i
> couldn't
> > > really get them to work and I want to have entities that hopefully
> isn't
> > > tied down to OpenJPA.
> > >
> > > --
> > > Morten
> >
> > --
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> > http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> >

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss 
für nur 17,95 Euro/mtl.!* 
http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Reply via email to