Position beyond number of declared ordinal parameters.

本文详细解析了在使用Hibernate框架时遇到的Positionbeyondnumberofdeclaredordinalparameters错误,通常由于中英文符号混用导致,如中文问号代替英文问号。通过一个具体示例,展示了如何排查和修正此类问题。

Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 2

org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 2
org.hibernate.engine.query.spi.ParameterMetadata.getOrdinalParameterDescriptor(ParameterMetadata.java:80)
org.hibernate.engine.query.spi.ParameterMetadata.getOrdinalParameterExpectedType(ParameterMetadata.java:86)
org.hibernate.internal.AbstractQueryImpl.determineType(AbstractQueryImpl.java:444)
org.hibernate.internal.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:416)

百度查看大佬的文章,这个错误出错的原因多半是中英字符运用错误,比如逗号或者问号

String hql = “from com.sharingbike.www.pojo.Images where bid = ? and bic = ?”;

我出错的地方就是第二个问号用的中文拼音的问号。

y.y:87.20-21: $3 of `assign_stmt' has no declared type y.y:97.45-46: $2 of `if_stmt' has no declared type y.y:100.50-51: $2 of `if_stmt' has no declared type y.y:105.55-56: $4 of `repeat_stmt' has no declared type y.y:110.25-26: $2 of `write_stmt' has no declared type y.y:130.21-22: $$ of `exp' has no declared type y.y:130.27-28: $1 of `exp' has no declared type y.y:130.33-34: $3 of `exp' has no declared type y.y:131.18-19: $$ of `exp' has no declared type y.y:131.24-25: $1 of `exp' has no declared type y.y:131.30-31: $3 of `exp' has no declared type y.y:132.18-19: $$ of `exp' has no declared type y.y:132.24-25: $1 of `exp' has no declared type y.y:132.29-30: $3 of `exp' has no declared type y.y:133.18-19: $$ of `exp' has no declared type y.y:133.24-25: $1 of `exp' has no declared type y.y:133.29-30: $3 of `exp' has no declared type y.y:134.18-19: $$ of `exp' has no declared type y.y:134.24-25: $1 of `exp' has no declared type y.y:134.30-31: $3 of `exp' has no declared type y.y:135.18-19: $$ of `exp' has no declared type y.y:135.24-25: $1 of `exp' has no declared type y.y:135.30-31: $3 of `exp' has no declared type y.y:136.18-19: $$ of `exp' has no declared type y.y:136.23-24: $1 of `exp' has no declared type y.y:136.28-29: $3 of `exp' has no declared type y.y:137.19-20: $$ of `exp' has no declared type y.y:137.24-25: $1 of `exp' has no declared type y.y:137.29-30: $3 of `exp' has no declared type y.y:138.18-19: $$ of `exp' has no declared type y.y:138.23-24: $1 of `exp' has no declared type y.y:141.25-26: $$ of `term' has no declared type y.y:141.30-31: $1 of `term' has no declared type y.y:141.35-36: $3 of `term' has no declared type y.y:143.8-9: $3 of `term' has no declared type y.y:145.9-10: $$ of `term' has no declared type y.y:147.9-10: $$ of `term' has no declared type y.y:147.14-15: $1 of `term' has no declared type y.y:147.19-20: $3 of `term' has no declared type y.y:150.12-13: $$ of `term' has no declared type y.y:150.17-18: $1 of `term' has no declared type y.y:153.15-16: $$ of `factor' has no declared type y.y:157.9-10: $$ of `factor' has no declared type y.y:160.9-10: $$ of `factor' has no declared type y.y:164.17-18: $$ of `factor' has no declared type y.y:164.22-23: $2 of `factor' has no declared type y.y:165.18-19: $$ of `factor' has no declared type y.y:165.24-25: $2 of `factor' has no declared type
最新发布
06-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值