数据库
首页 > 数据库> > LocalDateTime映射oracle日期类型的jdbcType问题

LocalDateTime映射oracle日期类型的jdbcType问题

作者:互联网

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>
————————————————
版权声明:本文为CSDN博主「Yangyufan95」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_45493694/article/details/119454783

标签:java,TIMESTAMP,LocalDateTime,jdbcType,oracle,org,null
来源: https://www.cnblogs.com/javalinux/p/16298054.html