j2ee的hibernate数据库不能更新Could not execute JDBC batch update

来源:百度知道 编辑:UC知道 时间:2024/05/17 08:36:44
Hibernate: update user set name=?, username=?, password=?, sex=?, where=?, qq=?, email=?, age=?, introduce=?, regdatetime=?, enddatetime=? where id=?
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update

Caused by: java.sql.BatchUpdateException: 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 'where='电信一区', qq=null, email=null, age=null, introduce=null, regdatetime=nul' at line 1

貌似是你的字段用了sql的关键字的问题
where=‘电信一区’,你把这个where字段换个别的名试下;

修改的实体可能不符合hibernate的状态规则。
建议你用get方式获得实体,然后修改实体,然后update。