Hibernate throws MultipleBagFetchException - cannot simultaneously fetch multiple bags

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

    Add a Hibernate-specific @Fetch annotation to your code:

    @OneToMany(mappedBy="parent", fetch=FetchType.EAGER)
    @Fetch(value = FetchMode.SUBSELECT)
    private List childs;
    

    This should fix the issue, related to Hibernate bug HHH-1718

提交回复
热议问题