今天在写Java项目使用了
SELECT
*
FROM
`plan`
WHERE
isDelete=#{isDelete} AND nestId in
open="(" close=")" separator=",">
#{nestId}
但是很不幸,后台报异常:java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
经过查找才发现是因为数据表有的addTime是“0000-00-00 00:00:00”,不论是Mybatis还是hibernate都认为不是一个有效的时间字串,而有效的日期格式为"2015-05-29 21:23:07"。
此时,可以为:
SELECT
`planId`, `type`, `planName`, `userId`, `nestId`, `userStatus`, `budgetStatus`, `budget`, `rule`, `isDelete`
FROM
`plan`
WHERE
isDelete=#{isDelete} AND nestId in
open="(" close=")" separator=",">
#{nestId}
但是在另一个SQL中只能使用“*”,所以我只能查找解决方法了。
经过查看官方文档和百度搜索。
记得可以使用
jdbc:mysql://localhost:3306/solr?characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useUnicode=true
解决!
所以我将Mysql JDBC Url参数表格附上,以便以后使用: