我的xml中有一个insert语句,如下所示。
<insert id="insertQuote" parameterMap="quoteParam">
<selectKey keyProperty="id" resultType="string">
select seq_quote_id.nextval as id from dual
</selectKey>
insert into insq_quotation (quote_id, search_product_type,
coverage_start_date, quote_date, zip, create_date, business_id,
county, status
)
values(? ,?, ?, sysdate, ?, default, 200, ?, 999)
</insert>
这是参数图
<parameterMap id="quoteParam" type="com.product.vo.QuoteVO">
<parameter property="id" jdbcType="INTEGER"/>
<parameter property="regionType" jdbcType="INTEGER" typeHandler="com.product.mybatis.RegionTypeHandler"/>
<parameter property="productType" jdbcType="INTEGER" typeHandler="com.product.mybatis.ProductTypeHandler"/>
<parameter property="coverageStartDate" jdbcType="DATE"/>
<parameter property="zip" jdbcType="VARCHAR"/>
<parameter property="county" jdbcType="VARCHAR"/>
</parameterMap>
QuoteVO已填充所有属性。这在ibatis中工作正常。但我正在迁移到mybatis,当我运行应用程序时,我收到以下错误。应用程序使用Oracle DB和Spring。 DB中县的数据类型为VARCHAR2。请指教。
2017-05-09 10:04:19 INFO IFPProductServiceImpl:36 - calling saveQuote QuoteVO [quoteId=null, applicationType=I, coverageStartDate=Tue May 09 10:04:18 PDT 2017, zip=90001, county=LA, subscriberNumber=12345]
2017-05-09 10:04:20 ERROR ExceptionControllerAdvice:17 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='county', mode=null, 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 #6 with JdbcType VARCHAR . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Invalid column index