• 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

  • 相关阅读:
    JDK6的switch支持不是很好
    团队作业(2)
    团队作业(1)
    4月30日
    重构:改善既有代码的设计有感
    4月28日
    4月27日
    4月26日
    4月25日
    4月24日
  • 原文地址:https://www.cnblogs.com/javalinux/p/16298054.html
Copyright © 2020-2023  润新知