0 Replies Latest reply on Feb 23, 2006 4:28 PM by Michael Newcomb

    Parent->Child relationship in same class

    Michael Newcomb Newbie

      JBoss 4.0.3SP1.

      I have a class:

      class Person
      {
       protected Person parent;
       protected Set<Person> children;
      
       @ManyToOne
       public Person getParent() ...
      
       @OneToMany(mappedBy = "parent")
       public Set<Person> getChildren() ...
      }


      Everything deploys fine. However, when I go to query these guys, it throws a 'NoSuchMethod' exception. I'm assuming it is having a problem finding the 'mappedBy' parameter, but am not sure.

      Is this type of 'self-relationship' possible in EJB 3.0? Am I missing something?

      I do not have time tonight to write a test case, but I will write one tomorrow and post it.

      Thanks,
      Michael