title: Hibernate @ManyToOne @OneToMany for the same entity
body: <p>I am trying to create an Entity that has a Parent and children from the same type as he is (like a tree).</p>
  
  <p>here is the code:</p>
  
  <blockquote>
    <p>@Entity
    @Table(name = "areas")
    public class Area {</p>
  </blockquote>
  
  <pre><code>@Id
  @Column(name = "id")
  @GeneratedValue
  private int id;
  
  @Column(name = "name")
  private String name;
  
  @Column(name = "area_type", nullable = true)
  private int areaType;
  
  @ManyToOne
  @JoinColumn(name="parent_area_id")
  private Area parentArea;
  
  @OneToMany (fetch = FetchType.EAGER, mappedBy = "parentArea")
  @Cascade({CascadeType.ALL})
  private Collection&lt;Area&gt; childAreas = new ArrayList&lt;Area&gt;();
  </code></pre>
  
  <p>i have seen this code in a few posts in stack overflow
  first of all when i try to save such entity to the database i get:</p>
  
  <pre><code>nested exception is org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
  </code></pre>
  
  <p>furthermore, there is something i don't understand fully about this design.</p>
  
  <p>if the children areas are mapped by the parent areas. wont it mean that "this" area will be among the children fached?
  i other words... wont the children areas be the children of the parent area of "this" class.</p>
  
  <p>thanks.</p>