[英]Calling postgreSQL stored procedure from Hibernate
When I try to call a stored procedure from Java
- Hibernate
. 当我尝试从
Java
- Hibernate
调用存储过程时。 I got the below error. 我收到以下错误。
org.hibernate.QueryException: Not all named parameters have been set:
and my Code 和我的代码
Query query = session.createSQLQuery("select commsrules.evalcommsrules(?::text,?::commsrules.t_commstype)");
query.setString(0, in_query);
query.setString(1, "TRIG");
result = query.list();
and I got the below exception 我得到了以下异常
org.hibernate.QueryException: Not all named parameters have been set: [:text, :commsrules.t_commstype] [select commsrules.evalcommsrules(?::text,?::commsrules.t_commstype)]
at org.hibernate.internal.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:390)
at org.hibernate.internal.SQLQueryImpl.verifyParameters(SQLQueryImpl.java:179)
at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:118)
please help me to resolve this issue 请帮助我解决此问题
Looks like it's parsing :text
and the other as a named parameter, even though you're trying to use positional parameters. 看起来它正在解析
:text
和另一个作为命名参数,即使您尝试使用位置参数也是如此。
You could modify the query to use CAST
instead of the ::
shorthand. 您可以修改查询以使用
CAST
代替::
简写。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.