Multiple fetches with EAGER type in Hibernate with JPA

前端 未结 2 1068
北恋
北恋 2020-11-29 02:40

I have an entity which contains:

@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = \"assessment\")
@OrderBy(value = \"order ASC\")
pr         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 03:11

    If you are using Hibernate and you do not care using Hibernate annotations :

    Annotate your collection fields with:

    @LazyCollection(LazyCollectionOption.FALSE)
    

    Remember to remove the fetchType attribute from the @OneToMany annotation.

提交回复
热议问题