【发布时间】:2014-11-12 02:28:34
【问题描述】:
我是 Hibernate Restrictions 的新手,需要一些帮助:
我有一个场景,我需要找到“标识符”为“HB001”或“HB002”、“HB003”和“HB004”的所有记录。也就是说,它应该返回4行,每行都有“标识符”为“HB00*”。
//here is the code
Criteria criteria = hibernateSession.createCriteria(ENTITY_CLASS);
List<String> ids = getIds(); //ids contains "HB001", "HB002", "HB003", "HB004" and I am sure this step has no issue.
criteria.add(Restrictions.eq("identifier", ids));
...
看起来criteria.add(Restrictions.eq("identifier", ids)) 不正确,查询返回空值。
有人可以帮忙吗?
【问题讨论】:
标签: java hibernate hibernate-criteria restrictions