【发布时间】:2016-01-26 19:57:05
【问题描述】:
我有 2 个具有以下关联的类:
public class Entry {
private Long id;
private String poNumber;
private List<Comment> comments;
}
public class Comment{
private Long id;
private Reason reason;
}
我正在使用 Hibernate 标准来设置条目对象列表的限制:
Criteria criteria = ((HibernateEntityManager) entityManager).getSession().createCriteria(Entry.class, "entry");
我有一个提供对象列表的搜索表单。为了限制“poNumber”,给定List<String> poNumbers 我这样做:
criteria.add(Restrictions.in("poNumber", poNumbers));
但我不知道什么时候,给定List<Reason> reasons,如何限制原因。我限制了相同的 Criteria 对象(即条目类)。
(与Fetching objects of class B stored in a list inside class A with Hibernate Criteria相关)
【问题讨论】: