|
|
1.在Entity类中定义FetchProfile@Entity(name = "Employee")
@FetchProfile(
name = "employee.projects",
fetchOverrides = {
@FetchProfile.FetchOverride(
entity = Employee.class,
association = "projects",
mode = FetchMode.JOIN
)
}
) |
Hibernate中提供了org.hibernate.annotations.FetchProfile标注和org.hibernate.annotations.FetchProfile.FetchOverride标注。
定义FetchProfile需要提供名称和要设置的关联属性。
2.在Session中支持FetchProfile| session.enableFetchProfile( "employee.projects" ); |
Session支持对名为employee.projects的FetchProfile。
---------------------
转自:https://blog.csdn.net/taiyangdao/article/details/52042740
程序猿的技术大观园:www.javathinker.net
[这个贴子最后由 flybird 在 2020-02-23 11:36:31 重新编辑]
|
|