”
其原因是數(shù)據(jù)庫字段存在這樣的值

百度了下:
這是因為 “0000-00-00 00:00:00”在mysql中是作為一個特殊值存在的,但是在Java中, java.sql.Date 會被視為 不合法的值,被JVM認為格式不正確。
解決辦法:
在jdbc的url加上 zeroDateTimeBehavior參數(shù):
datasource.url=jdbc:mysql://localhost:3306/pe?useUnicode=true&characterEncoding=gbk &zeroDateTimeBehavior=convertToNull
完了過后,報異常
The reference to entity "characterEncoding" must end with the ';' delimiter
其原因可能是在Properties文件或者xml文件中忘記進行特殊符號的轉(zhuǎn)譯了,
需要把后面的;修噶為&修改為
useUnicode=true&characterEncoding=UTF-8 &zeroDateTimeBehavior=convertToNull
有以下幾類字符要進行轉(zhuǎn)義替換:
< | < | 小于號 |
> | > | 大于號 |
& | & | 和 |
' | ' | 單引號 |
" | " | 雙引號 |
問題解決
