Hibernate throws MultipleBagFetchException - cannot simultaneously fetch multiple bags

前端 未结 15 2049
广开言路
广开言路 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 12:59

    When you have too complex objects with saveral collection could not be good idea to have all of them with EAGER fetchType, better use LAZY and when you really need to load the collections use: Hibernate.initialize(parent.child) to fetch the data.

提交回复
热议问题