即使FetchMode = Join,也会发出Hibernate发出select语句 [英] Hibernate Issuing select statement even if FetchMode = Join
本文介绍了即使FetchMode = Join,也会发出Hibernate发出select语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个映射到国家/地区实体的userAccount实体. UserAccount类中的国家/地区映射是这样的
I have a userAccount entity mapped with a country entity . The country mapping in UserAccount class is like this
@ManyToOne(fetch=FetchType.EAGER)
@Fetch(FetchMode.JOIN)
@JoinColumn(name="f_country_id", nullable=true, insertable=false, updatable=false)
private Country country;
即使将fetchmode定义为Join,hibernate也会触发单独的SQL Select来提取国家/地区.
Even there is fetchmode defined as Join, hibernate fires a separate SQL Select to fetch countries.
推荐答案
删除fetch=FetchType.EAGER
.渴望获取将触发级联选择语句.
Remove the fetch=FetchType.EAGER
. Eager fetching triggers cascading select statements.
这篇关于即使FetchMode = Join,也会发出Hibernate发出select语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文