IF (((SELECT COUNT(*) FROM com.abc.domain.dcm.Program AS p
INNER JOIN p.programServiceLevelConfigs AS pslc
INNER JOIN pslc.taskPackages AS taskPackages
WHERE taskPackages.id = :taskPackageId) > 0) OR
((SELECT COUNT(*) from com.abc.domain.dcm.HcsEnrollmentBhpSetup hbs
INNER JOIN hbs.taskPackageMap
WHERE elements(hbs.taskPackageMap.id) = :taskPackageId) > 0))
SELECT 1
ELSE
SELECT 0
我正在设置查询参数:
query.setParameter("taskPackageId", taskPackageId);
在执行上述HQL查询时,我得到以下异常堆栈跟踪:
java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [taskPackageId]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:379)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:72)
非常感谢任何帮助。