java对象的日期类型选择LocalDateTime映射oracle的date类型时,jdbcType选择TIMESTAMP时,依旧会报错:
Caused by: org.apache.ibatis.type.TypeException:
Could not set parameters for mapping:
ParameterMapping{property='cretTime', mode=IN, javaType=class java.time.LocalDateTime, jdbcType=TIMESTAMP, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}.
Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType TIMESTAMP . Try setting a different JdbcType for this parameter or a different configuration property.
Cause: java.sql.SQLException:无效的列类型
查资料发现貌似是因为不兼容LocalDateTime(有待确定)。
解决方法:
实体对象中的日期类型改为Date。
或者在pom文件中添加依赖:
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
<version>1.0.2</version>
</dependency>