MyBatis中PersistenceException:Error querying database. Cause: org.apache.ibatis.type.TypeException:
生活随笔
收集整理的這篇文章主要介紹了
MyBatis中PersistenceException:Error querying database. Cause: org.apache.ibatis.type.TypeException:
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘arg0’, mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
The error may exist in com/atguigu/mybatis/mapper/ParameterMapper.xml
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: – select * from t_user where username =? and age =?; select * from t_user where username = ‘ad’ and sex = ‘男’;
Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘arg0’, mode=IN, javaType=cla
出現了這個問題,剛開始以為是sql語句寫錯了,就一直在加空格或者減空格,最后發現是注釋的問題
在灰色的select那行,是我按鍵盤ctrl+alt+?來進行idea軟件的默認注釋的,本以為這樣也算是在xml中的注釋,結果并不是,當把這種注釋用手動注釋起來時候
程序運行正常,說明在xml文件里面并不能使用快捷鍵進行注釋。
總結
以上是生活随笔為你收集整理的MyBatis中PersistenceException:Error querying database. Cause: org.apache.ibatis.type.TypeException:的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mybatis报错ClassNotfin
- 下一篇: Vagrant安装centos7时一直报