java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

### Error querying database.Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp ### The error may exist in file [/Users/albert/Workspace/IDEA/SmartCompus/target/SmartCompus/WEB-INF/classes/com/komlin/modular/smart/mapper/mapping/RoomWorkTypeMapper.xml] ### The error may involve com.komlin.modular.smart.mapper.RoomWorkTypeMapper.listByCondition ### The error occurred while handling results ### SQL: select room_work_type.*, mr_name,mr_placefrom room_work_typeleft join meet_room on rwt_room_id = mr_id limit 0,10 ### Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp ; 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 at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:108) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]

以上是我的异常;
原因 【java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp】数据库没有存时间,在jdbc中进行转化时,无法转化。就会抛出改异常
解决
  1. 整理数据库数据
  2. 在数据库连接时添加zeroDateTimeBehavior=convertToNull 自动转化为null
    jdbc.url=jdbc:mysql://127.0.0.1:3306/oa?zeroDateTimeBehavior=convertToNull

    推荐阅读