Hibernate throws MultipleBagFetchException - cannot simultaneously fetch multiple bags

前端 未结 15 1978
广开言路
广开言路 2020-11-22 12:49

Hibernate throws this exception during SessionFactory creation:

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

15条回答
  •  故里飘歌
    2020-11-22 13:00

    After trying with every single option describe in this posts and others, I came to the conclusion that the the fix is a follows.

    In every XToMany place @XXXToMany(mappedBy="parent", fetch=FetchType.EAGER) and intermediately after

    @Fetch(value = FetchMode.SUBSELECT)
    

    This worked for me

提交回复
热议问题