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;
是'activityStep'引用或收藏?爲什麼currentStep數字不是對Step的引用? – Firo 2012-04-26 09:58:20
activityStep只是引用另一個表,這就是爲什麼使用簡單的連接。上面的查詢使用EMPLOYEE_ACTIVITY_ID簡單地連接到兩個EmployeeActivity&ActivityStep表。 – gviswanathan 2012-04-26 16:50:04