Remember that ordinal parameters are 1-based! (and I am)

来源:互联网 发布:中国社交平台使用数据 编辑:程序博客网 时间:2024/05/16 18:02

setParameter(1,"param")

发生错误..还是应该好好看看api


setParameter

Query setParameter(int position,                   Object val)                   throws HibernateException
Bind a value to a JDBC-style query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the given object.

Parameters:
position - the position of the parameter in the query string, numbered from 0.
val - the non-null parameter value
Throws:
HibernateException - if no type could be determined

原创粉丝点击