title: Hibernate : org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
body: <p><strong>Entity classes</strong></p>
  
  <p><strong>Customer</strong></p>
  
  <pre><code>       @Entity
          @Table(name="Custumer")
          public class Custumer implements Serializable {
  
              @Id
              @GeneratedValue(strategy = GenerationType.IDENTITY)
              @Column(name="id")
              private Long id;
              @Column(name="name",unique = true)
              private String name;
              @Column(name="Email",unique = true)
              private String Email;
              @Column(name = "Coins")
              private Double coins;
  
              @ManyToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
  
              private List&lt;ShippingAdress&gt; shippingAdress = new ArrayList&lt;ShippingAdress&gt;();
  
  
              @OneToMany( fetch = FetchType.EAGER, mappedBy = "custumer", cascade = CascadeType.ALL,orphanRemoval = true)
  
              private List&lt;Order&gt; orders= new LinkedList&lt;Order&gt;();
  //...
  </code></pre>
  
  <p><strong>ShippingAdress</strong></p>
  
  <pre><code>    @Entity
          @Table(name="ShippingAdress")
          public class ShippingAdress implements Serializable {
  
              @Id
              @GeneratedValue(strategy = GenerationType.IDENTITY)
              @Column(name="id")
              private Long id;
              @Column(name="postCode")
              private String PostCode;
              @Column(name="street")
              private String street;
              @Column(name="house")
              private String house;
              @Column(name="flat")
              private String flat;
  
              @ManyToMany(mappedBy = "shippingAdress")
              private List&lt;Custumer&gt; custumers = new LinkedList&lt;Custumer&gt;();
      //...
  </code></pre>
  
  <p><strong>Items</strong></p>
  
  <pre><code>@Entity
      @Table(name="Items")
      public class Items implements  Serializable,Comparable&lt;Items&gt;  {
  
          @Id
          @GeneratedValue(strategy = GenerationType.IDENTITY)
  
          @Column(name="id")
          private Long id;
          @Column(name="name", unique = true)
          private String name;
          @Column(name="price")
          private double price;
          @Column(name="count")
          private int count;
  
          @OneToMany(mappedBy = "item", cascade = CascadeType.ALL,orphanRemoval = true)
          List&lt;Order&gt; orders = new LinkedList&lt;Order&gt;();
      //...
  </code></pre>
  
  <p><strong>CustomerOrder</strong></p>
  
  <pre><code>@Entity
  @Table(name = "CustumerOrder")
  public class Order implements Serializable {
      @Id
      @ManyToOne
      private Custumer custumer;
  
  
      @Id
      @ManyToOne
  
      private Items item;
  </code></pre>
  
  <p>When I'm trying to get all orders from particular customer </p>
  
  <pre><code>  public List&lt;Order&gt; getOrderByCustumerId(Custumer custumer) {
  
          Criteria criteria = session.createCriteria(Order.class);
          List&lt;Order&gt; res = (List&lt;Order&gt;) criteria.add(Restrictions.eq("custumer",custumer)).list();
  
          return res;
      }
  </code></pre>
  
  <p>I'm facing the following exception:</p>
  
  <pre><code>org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
  </code></pre>
  
  <p>If delete <code>fetch = FetchType.EAGER</code> from one of the places they are existed 
  getting the following:
  (supposed  deleted from customer )</p>
  
  <pre><code>   org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.CoinsShop.DataBase.DataSets.Custumer.shippingAdress, could not initialize proxy - no Session
  </code></pre>
  
  <p>relations in DB</p>
  
  <p><a href="https://i.stack.imgur.com/TM1lU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TM1lU.png" alt="database relations"></a></p>