我用hibernate的save方法插入数据报错,求大神指点
User[id=null,type=1,name=aa,code=123456789,company=aaa,tel=13811111,ip=127.0.0.1,inse...
User [id=null, type=1, name=aa, code=123456789, company=aaa, tel=13811111, ip=127.0.0.1, insert_time=1415424295191, check_time=null, password=123, check=0]
Hibernate:
insert
into
tb_user
(type, name, code, company, tel, ip, insert_time, check_time, password, check)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
org.hibernate.exception.SQLGrammarException: could not insert: [com.web.model.User]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check) values ('1', 'aa', '123456789', 'aaa', '13811111', '127.0.0.1', 141542429' at line 1 展开
Hibernate:
insert
into
tb_user
(type, name, code, company, tel, ip, insert_time, check_time, password, check)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
org.hibernate.exception.SQLGrammarException: could not insert: [com.web.model.User]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check) values ('1', 'aa', '123456789', 'aaa', '13811111', '127.0.0.1', 141542429' at line 1 展开
3个回答
展开全部
很明显其中一个字段有问题 需要我远程给你解决下吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是类型转换的问题吧?或者check字段有问题?
追问
我把字段名全改了,结果报
Data truncation: Out of range value for column 'user_insert_time' at row 1
这个错误 mysql数据库中的时间我用int存的
java类中用long
这样好像不行,怎么改啊
追答
inserttime不是日期型的吗,你用日期啊
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询