0

我们可以在哪些条件下添加限制?

对于 HQL-1#

select activity from EmployeeActivity activity
   join activity.activityStep as step
   where
   activity.currentStep = 1;

Criteria ctr = getSession().createCriteria(EmployeeActivity.class)
   .createCriteria("activityStep")//Where activityStep is the another entity which is joined
   .add(Restrictions.eq("currentStep", 1))

但是我应该如何为下面的 HQL 查询编写?而且,最佳做法是什么。

select activity from EmployeeActivity activity
   join activity.activityStep as step
   where
   activity.currentStep = step.stepNumber;
4

1 回答 1

1

虽然我不确定查询应该做什么

Criteria ctr = getSession().createCriteria(EmployeeActivity.class)
   .createAlias("activityStep", "step")
   .add(Restrictions.propertyEq("currentStep", "step.stepNumber"));
于 2012-04-27T06:00:47.527 回答