[4J]
短点链接: https://nutz.cn/s/c/4J
8 回复
@milixiang pojo属性是字符串,但数据库里面是datetime?
来自炫酷的 NutzCN
再建一个pojo,里面就一个id和addTime,然后通过dao.create建表,再测试一下
来自炫酷的 NutzCN
[DEBUG] 2015-12-05 16:44:15 :{conn-10001} pool-connect
[DEBUG] 2015-12-05 16:44:15 :{conn-10001} setAutoCommit false
[DEBUG] 2015-12-05 16:44:15 :INSERT INTO user1(add_time) VALUES(?)
| 1 |
|---------------------|
| 2015-12-05 16:44:14 |
For example:> "INSERT INTO user1(add_time) VALUES('2015-12-05 16:44:14') "
[DEBUG] 2015-12-05 16:44:15 :{conn-10001, pstmt-20025} created.
INSERT INTO user1(add_time) VALUES(?)
[DEBUG] 2015-12-05 16:44:15 :{conn-10001, pstmt-20025} Parameters : [2015-12-05 16:44:14.316]
[DEBUG] 2015-12-05 16:44:15 :{conn-10001, pstmt-20025} Types : [TIMESTAMP]
[ERROR] 2015-12-05 16:44:15 :{conn-10001, pstmt-20025} execute error. INSERT INTO user1(add_time) VALUES(?)
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'add_time' at row 1
mysql驱动问题,目测用了古董版驱动
来自炫酷的 NutzCN
添加回复
请先登陆