我在 Hibernate 5 中映射了这个实体
class A {
private String code;
private B child;
@LazyToOne(LazyToOneOption.PROXY)
@ManyToOne(fetch=FetchType.LAZY)
@NotFound(action=NotFoundAction.IGNORE)
@JoinColumns({...})
public B getChild() { ... }
}
Run Code Online (Sandbox Code Playgroud)
我只加载 A 的查询是:
from A where a.code like :q
Run Code Online (Sandbox Code Playgroud)
通过此配置,Hibernate 对 A 和 B 实体进行选择。我不希望它加载 B 而只加载 A
我缺少什么?