java.time.LocalDateTime cannot be cast to java.sql.Timestamp
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed GitHub issues.
- Read documentation: ShardingSphere Doc.
Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
sharding-jdbc-spring-boot-starter 4.0.1 mysql-connector-java 8.0.23
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
Actual behavior
column:
start_date datetime DEFAULT NULL COMMENT '开始时间 ',
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'startDate' from result set. Cause: java.lang.ClassCastException: java.time.LocalDateTime cannot be cast to java.sql.Timestamp
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy89.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy137.getUserGoodsByIccid(Unknown Source)
Reason analyze (If you can)
use mysql-connector-java 8.0.19 is fine but can`t use mysql-connector-java 8.0.23+
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
Hi @JiaXiaohei , Can you try the latest version 5.0.0-beta? I think the time issue has been fixed.
Hi @RaigorJiang Is fine. Looks like I can only wait for used in production after 5.0.0-release. T_T
@JiaXiaohei 5.0.0-RC1 is on the way.