1 Reply Latest reply on Sep 1, 2005 12:35 PM by Emmanuel Bernard

    Entity with ManyToOne to same entity

    Pepe Mosca Newbie

      Hi,

      Is it possible to relate an entity with itself using @ManyToOne? I have a table that actually is a tree, so it has a filed (parent_id) that relates a children to it's parent using an id.
      In beta1 (jboss 4.0.3.RC1) this worked ok, but in rc1 (jboss 4.0.3RC2) the parent_id field is unique and I can't create a tree anymore...

      I am using something like this for the getter:

      @ManyToOne
      @JoinColumn(name="parent_id", referencedColumnName="id")
      public Node getParentNode() {
      ...
      }


      I've seen that this is the first version that referenceColumnName works... can be this the problem? Is there something I am doing wrong?

      Regards,

      Bruno