最近在调试项目时,出现了这个问题:
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'examDate' at row 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1124) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:676) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1166) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1082) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1067) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:187) ... 99 more
这其实是你的mysql驱动包版本太低,我用的是mysql-connector-java-3.1.12-bin.jar,版本太老导致有问题;
解决方案:换一个版本高一点的,比如mysql-connector-java-5.1.47-bin.jar,在lib包下面将低版本的替换掉,再重启服务器就可以了!