Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'createTime' of 'class com.example.entity.User' with value 'Tue May 14 14:35:18 CST 2024' Cause: java.lang.IllegalArgumentException: argument type mismatch
Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'createTime' of 'class com.example.entity.User' with value 'Tue May 14 14:35:18 CST 2024' Cause: java.lang.IllegalArgumentException: argument type mismatch
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.saveBatch(ServiceImpl.java:125)
当前使用版本 mybatis-plus 3.0.1;mybatis 3.4.6; mysql-connector-java 5.1.38; HikariCP 2.7.0 当前环境信息 Java8+Mysql5.7.28 描述bug现象 在插入createTime(在Java中是LocalDateTime类型,在mysql中是datetime类型)这个字段时,报错:Cause: java.lang.IllegalArgumentException: argument type mismatch 提供问题复现步骤 java实体中设置实体类的createTime字段 user.setCreateTime(LocalDateTime.now()); 提供完整堆栈日志(可选) Caused by: org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'createTime' of 'class com.example.entity.User' with value 'Tue May 14 14:35:18 CST 2024' Cause: java.lang.IllegalArgumentException: argument type mismatch
Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'createTime' of 'class com.example.entity.User' with value 'Tue May 14 14:35:18 CST 2024' Cause: java.lang.IllegalArgumentException: argument type mismatch
提供问题复现工程(可选) 请尽量提供复现工程,减少大家排错的时间.