我正在使用 HQL 查询来获取一堆状态对象,如下所示:
<cfquery name="LOCAL.qStates" dbtype="hql">
from States where countryID = #ARGUMENTS.countryID#
order by name asc
</cfquery>
这很好用。不过,我从小就长大了,我想用cfqueryparam
,理想情况下像这样:
<cfquery name="LOCAL.qStates" dbtype="hql">
from States
where countryID = <cfqueryparam cfsqltype="cf_sql_integer" value="#ARGUMENTS.countryID#" />
order by name asc
</cfquery>
但这会引发错误:
[empty string] java.lang.NullPointerException at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:353) at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:323) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:98) at coldfusion.orm.hibernate.HibernatePersistenceManager._executeHQL(HibernatePersistenceManager.java:822) at coldfusion.orm.hibernate.HibernatePersistenceManager.executeHQL(HibernatePersistenceManager.java:751) at ....
任何人都知道如何解决这个问题并使用cfqueryparam
with cfquery
HQL 查询?
提前致谢!
去掉数据类型,它不是必需的,并且休眠可能不理解它们。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)