title: Hibernate cannot simultaneously fetch multiple bags two Lists
body: <p>I have very strange situation. Before when I tried to fetch multiple collections by one try of HQL query I have not had this error. The Internet says that the problem can occur because of FetchType.LAZY, but I removed it and nothing change.</p>
  
  <p>My entity from where I'm trying to fetch some data: </p>
  
  <pre><code>@Entity
  @Table(name="INSTITUTION_IN_FORM")
  public class InstitutionInForm implements Serializable {
  
  
      private static final long serialVersionUID = -721358037476057890L;
  
  
      private int institutionId;
  
          @Id
          @GeneratedValue(strategy= IDENTITY)
          @Column(name="INSTITUTION_ID")
          public int getInstitutionId() {
              return institutionId;
          }
          public void setInstitutionId(int institutionId) {
              this.institutionId = institutionId;
          }
  
  
      private int version;
  
          @Version
          @Column(name="VERSION")
          public int getVersion() {
              return version;
          }
          public void setVersion(int version) {
              this.version = version;
          }
  
  
      private String nameOfInstitution;
  
          @Column(name="INSTITUTION_NAME")
          public String getNameOfInstitution() {
              return nameOfInstitution;
          }
          public void setNameOfInstitution(String nameOfInstitution) {
              this.nameOfInstitution = nameOfInstitution;
          }       
  
  
      private List&lt;FormDate&gt; formDateList = new ArrayList&lt;FormDate&gt;();
  
          @ManyToMany(mappedBy="institutions")
          @Cascade(CascadeType.ALL)
          public List&lt;FormDate&gt; getFormDateList() {
              return formDateList;
          }
          public void setFormDateList(List&lt;FormDate&gt; formDateList) {
              this.formDateList = formDateList;
          }
  
  
      private List&lt;FormDescription&gt; formDescriptionList = new ArrayList&lt;FormDescription&gt;();
  
          @OneToMany(mappedBy="institutions", orphanRemoval=true)
          @Cascade(CascadeType.ALL)
          public List&lt;FormDescription&gt; getFormDescriptionList() {
              return formDescriptionList;
          }
          public void setFormDescriptionList(List&lt;FormDescription&gt; formDescriptionList) {
              this.formDescriptionList = formDescriptionList;
          }
  }
  </code></pre>
  
  <p>My dao method I use to find data in DB:</p>
  
  <pre><code>@SuppressWarnings("unchecked")
  @Override
  public List&lt;InstitutionInForm&gt; fetchByName(String institutionName) {        
      return sessionFactory.getCurrentSession().createQuery("select distinct institution from InstitutionInForm institution " +
                                                  "left join fetch institution.formDateList formDate left join fetch institution.formDescriptionList formDescription where institution.nameOfInstitution= :institutionName")
                                                                                                      .setParameter("institutionName", institutionName).list();
  }
  </code></pre>
  
  <p>My error stacktrace:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
      at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:93)
      at org.hibernate.loader.hql.QueryLoader.&lt;init&gt;(QueryLoader.java:121)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:204)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
      at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:105)
      at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:80)
      at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168)
      at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221)
      at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199)
      at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1778)
      at edu.demidov.dao.EducationWebDaoImpl.fetchByName(EducationWebDaoImpl.java:67)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy24.fetchByName(Unknown Source)
      at edu.demidov.dao.AppOut.main(AppOut.java:52)
  </code></pre>
  
  <p>What may be a problem with it. Any help will be well appreciated. Thank you guys.</p>