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

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

異常現象

### 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
org.springframework.dao.TransientDataAccessResourceException: 
### Error querying database.  Cause: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

最簡單的解決辦法:

在jdbc的鏈接中增長:zeroDateTimeBehavior=convertToNulljava

參考資料:

相關文章
相關標籤/搜索