2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.GeneralDaoImpl -GeneralDaoImpl.java(100) -GeneralDao getEntity with sql has failed! select * from user_base where userName = ? org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback; SQL [ select * from user_base where userName = ? ]; Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.; nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.

我会在这里猜测你正在使用MySQL :-)它使用“零日期”作为特殊的占位符 - 不幸的是,JDBC默认情况下无法处理它们。

解决方案是将“zeroDateTimeBehavior = convertToNull”指定为MySQL连接的参数(在数据源URL或附加属性中),例如:

 jdbc:mysql://localhost/myDatabase?zeroDateTimeBehavior=convertToNull

这将导致所有这些值被检索为NULL。

 

相关文章:

  • 2021-05-18
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-05-21
  • 2021-08-22
  • 2021-11-10
  • 2021-04-19
猜你喜欢
  • 2022-01-08
  • 2021-09-03
  • 2021-09-30
  • 2021-12-13
  • 2021-06-08
  • 2022-12-23
  • 2021-08-21
相关资源
相似解决方案