1. Error attempting to get column 'LAST_MSG_TIME' from result set. Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
    2. ; SQL []; Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp]org.springframework.dao.TransientDataAccessResourceException: Error attempting to get column 'LAST_MSG_TIME' from result set. Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
    3. ; SQL []; Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp; nested exception is java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
    4. at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108)
    5. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    6. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    7. at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
    8. at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
    9. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
    10. at com.sun.proxy.$Proxy29.selectOne(Unknown Source)
    11. at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)
    12. at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
    13. at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
    14. at com.sun.proxy.$Proxy43.findByAppIdAndOpenId(Unknown Source)

    解决方案

    • 第一种

      1. ALTER TABLE table_name MODIFY COLUMN date TIMESTAMP NULL
    • 第二种

      1. jdbc:mysql://yourserver:3306/yourdatabase?zeroDateTimeBehavior=convertToNull