0
一個兒童在使用,爲什麼休眠加載父實體:Hibernate的4發現在FetchType.Eager映射
在父子關係,其中有一個FetchType.Eager映射,我注意到,Hibernate會加載父實體任何時間和EntityManager.find都是在一個孩子身上執行的。這似乎有點浪費。父級的「幕後」加載會導致持久化上下文中出現額外的SELECT和額外對象。另外,它forces the app to address the parent-child association when removing a child。
爲什麼Hibernate的行爲是這樣的?這是由JPA規範強制嗎?