我有类似的东西:
@Entity
public class First {
<...>
@OneToMany
@JoinColumn(name = "first-id", nullable = false)
private List<Second> seconds = new ArrayList<Second>();
}
@Entity
@Subselect(...)
public class FirstView {
<...>
private List<Second> seconds = new ArrayList<Second>();
}
如何在FirstView.seconds
上加载session.createCriteria(FirstView.class).add(<...>).list()
。
答案 0 :(得分:0)
seconds
中的 FirstView
应以与First
中省略不足部分相同的方式进行注释。在给定的情况下,它看起来如此:
@OneToMany
@JoinColumn(name = "first-id")
private List<Second> seconds = new ArrayList<Second>();