java如何使用子查询。在里面
如何通过criteria API表达这种HQL查询
select a from A a where
(select b.prop from B b where b.id = a.parent) in ('1', '2', '3')
ID列表作为参数传递
下面是我的子查询:
DetachedCriteria subQuery = DetachedCriteria.forClass(B.class, "b").
.add(Restrictions.eqProperty("b.id", "a.parent"))
.setProjection(Projections.property("b.prop"));
子查询。在和属性中,的工作方式正好相反(在子查询中使用prop,而不是我需要的在prop中使用子查询)。有什么想法吗
共 (0) 个答案