mybatis的mapper中,为什么当jdbcType=INT的时候会报错,改成INTEGER就好了?

图片描述

数据库中是int呀,并不是Integer
图片描述

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'billMapper' defined in file [F:\lqb-web\target\lqb\WEB-INF\classes\com\lqb\web\dao\BillMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [F:\lqb-web\target\lqb\WEB-INF\classes\mapper\ContractTerminationMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.INT

回答:

JDBC type:

TINYINT

SMALLINT

INTEGER

BIGINT

*没有INT类型*

建议你看下mybatis的枚举类JdbcType就清楚了。

其实你的报错信息里面已经很清楚了,
java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.INT

回答:

JdbcType 和数据库中的type不是一回事 有一个映射的关系

以上是 mybatis的mapper中,为什么当jdbcType=INT的时候会报错,改成INTEGER就好了? 的全部内容, 来源链接: utcz.com/p/174540.html

回到顶部