JPA default fetch type

后端 未结 4 751
小鲜肉
小鲜肉 2021-02-07 03:14

From my understanding @OneToOne and @ManyToOne JPA annotations do an eager fetch. I want these to be lazily loaded in my application, or a

4条回答
  •  孤城傲影
    2021-02-07 03:31

    To date, I have chosen to have Hibernate follow the JPA spec in terms of mapping via annotations simply because I have not received any feature requests for making it configurable, which was surprising TBH. As you point out, since Hibernate 3.0 what you want has been the default set up when using hbm.xml mapping files.

    Allowing this via configuration would not violate the spec as another answer suggested.

    So long story short, no it is not possible today. Create a feature request if you'd like to see that be configurable.

提交回复
热议问题