Hibernate throws MultipleBagFetchException - cannot simultaneously fetch multiple bags

前端 未结 15 1971
广开言路
广开言路 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:03

    You could use a new annotation to solve this:

    @XXXToXXX(targetEntity = XXXX.class, fetch = FetchType.LAZY)
    

    In fact, fetch's default value is FetchType.LAZY too.

提交回复
热议问题