1 Reply Latest reply on Mar 3, 2006 12:02 AM by bill.burke

    Recursive Relationships

    jmiguel77

      Is there any way to represent a recursive relationship with annotations in an entity bean ??

      I have tried this:

      @ManyToOne
      @JoinColumn(name="PARENT_ID", referencedColumnName="ITEM.ITEM_ID")
      public Item getItem() {
      return item;
      }

      @OneToMany(mappedBy="item")
      public Collection getItemCollection() {
      return itemCollection;
      }

      But when i try to access the getItemCollection result it crashes

      The thing is, that the Item entity must have this recursive relationship to provide a hierarchical tree of records

      Thanks a lot