记录mybatis中一个坐一天的错误
Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘inputFlag’, mode=IN, javaType=class java.lang.String, jdbcType=VARCHAR, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType VARCHAR . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 4).
原因:sql语句中加了注释,去除注释即可正常运行
另:mybatis中mysql的时间段内查询语句
<if test="uploadTimeEnd!=null and uploadTimeEnd!=''">
<![CDATA[ and DATE_FORMAT(D_CREATE_TIME, '%Y-%m-%d')< DATE_FORMAT(#{uploadTimeEnd}, '%Y-%m-%d') +1 ]]>
</if>
mybatis中oracle的时间段内查询
<if test="uploadTimeEnd!=null and uploadTimeEnd!=''">
AND D_CREATE_TIME <![CDATA[<]]> TO_DATE(#{uploadTimeEnd, jdbcType = VARCHAR},'yyyy-mm-dd') + 1
</if>