2019独角兽企业重金招聘Python工程师标准>>>
The short answer is: Hibernate does NOT support lazy one-to-one relationships
the long answer is: workaround 1) declare the releationship to be one-to-one on one side (child), and one-to-many on the other side (parent) Thus a parent.getchild() returns a set, yet it will be able to use lazy loading.
-
you can try to have the parent and the children to share the primary key, but this would require ou to alter the schema
-
you can try to configure a view in your database reflecting this one-to-one relationship/.
hibernate OneToOne child side oneToMany parent side 不支持懒加载 设置 OneToOne parent side child side 共享主键 但要修改表结构。