org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags

前端 未结 7 848
南笙
南笙 2020-12-04 20:07

Following is my code Here I am using multiple lists to fetch data from database. On fetching data from hql query it is showing exception.

Pojo Class

         


        
7条回答
  •  没有蜡笔的小新
    2020-12-04 20:55

    You can only join-fetch following one relation for an entity (either billPaidDetailses or billProductList).

    Consider using lazy associations and loading collections when they are needed, OR using lazy associations and loading collections manually with Hibernate.initialize(..). At least that was the conclusion I came to when I had a similar issue.

    Either way it will take more than one query to the database.

提交回复
热议问题