oracle设置自动增长id,mybatis如何插入数据?

我的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: 请求的转换无效

请问应该怎么处理?

你的语法有问题,既然你设置了数据库自增长,成功返回数据ID,那么为什么还要添加ID属性?参考:
insert into FLIGHTS(
FLIGHT_CODE,FLIGHT_DATE,AIRLINE,TYPE,TAKE_AIRPORT_ID,LANDING_AIRPORT_ID,TAKE_TIME,LANDING_TIME,FLIGHT_TIME,STOP_AIRPORT,REFERENCE_PRICE)
values(
#{flightCode},#{flightDate},#{airline},#{type},#{takeAirportId},#{landingAirportId},#{takeTime},#{landingTime},#{flightTime},#{stopAirport},#{referencePrice})

oracle是用得 序列自增长 ,你sql写的好像不对吧 图片说明

你的返回值是什么呢,是否与com.entity.Flights.id一致,然后插入的时候不需要写id的