我的mybatis的xml mapper文件语句如下:
<insert id="insertFlights" parameterType="com.entity.Flights" useGeneratedKeys="true" keyProperty="id">
insert into FLIGHTS(ID,FLIGHT_CODE,FLIGHT_DATE,AIRLINE,TYPE,TAKE_AIRPORT_ID,LANDING_AIRPORT_ID,TAKE_TIME,LANDING_TIME,FLIGHT_TIME,STOP_AIRPORT,REFERENCE_PRICE)
values(#{id},#{flightCode},#{flightDate},#{airline},#{type},#{takeAirportId},#{landingAirportId},#{takeTime},#{landingTime},#{flightTime},#{stopAirport},#{referencePrice})
</insert>
报的异常如下:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='id', mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
如果我把xml mapper里的语句去掉id字段;则报异常如下:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column #1 from result set. Cause: java.sql.SQLException: 请求的转换无效
请问应该怎么处理?