转自:http://blog.csdn.net/stronglyh/article/details/45369611
mybatis报错:java.sql.SQLException: 无效的列类型: 1111
Java.sql.SQLException: 无效的列类型: 1111
at Oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3900)
at oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4406)
主要是配置文件sql的参数问题
比如
<select id="select_repair_list" parameterType="String" resultMap="car">
SELECT car_num
from car where car_id = #{id}
</select>
sql要改成
SELECT car_num
from car where car_id = #{id,jdbcType=VARCHAR}
如果id是数值 那么id = #{id,jdbcType=NUMERIC}
完毕
注意,一般用${all}时不适用jdbcType,如下:
a.xm like '%${all}%'
此时不能加jdbcType=VARCHAR
;
另外,这里的jdbcType也可以通过在mapper的配置文件中进行如下配置:
<resultMap id="GuardianDeptMap" type="com.cdkj.correct.domain.Guardian">
<id column="PK_ID" jdbcType="INTEGER" property="pkId" />
<result column="dept_pk" property="deptPk" jdbcType="INTEGER" />
<result column="dept_name" property="deptName" jdbcType="VARCHAR" />
<result column="CREATE_PK" jdbcType="INTEGER" property="createPk" />
<result column="CREATE_TIME" jdbcType="VARCHAR" property="createTime" />
<result column="ADJ_PK" jdbcType="INTEGER" property="adjPk" />
<result column="OLD_PK_ID" jdbcType="INTEGER" property="oldPkId" />
</resultMap>
效果是一样的,一般采用第二种方法。