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

Reply via email to