【发布时间】:2011-09-09 11:33:54
【问题描述】:
我试图在数据库中保存一个简单的对象,但它给我带来了问题。
这是我的对象类:
@Entity
@Table(name="lines")
public class Line extends GenericModel{
@Id
@Column(name="line_id")
private int id;
@Column(name="line_text")
private String text;
@Column(name="line_postid")
private int postid;
@Column(name="line_position")
private int position;
}
这就是我的控制器中的内容:
Line l = new Line();
l.setPosition(0);
l.setPostid(4);
l.setText("geen");
l.save();
我正在为其他模特做同样的事情,我没有任何问题,只有这个给我带来了问题。当我刷新浏览器时,我得到:
PersistenceException occured : org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
我还在我的配置中添加了jpa.debugSQL=true,并且在我的控制台中我得到了:
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 'lines (line_position, line_postid, line_text, line_id) values (0, 4, 'geen', 0)' at line 1
浏览器也显示:This exception has been logged with id 66k3glbb6,但我不知道在哪里可以查看我的日志,所以如果有人也可以告诉我吗?
【问题讨论】:
标签: java sql jpa persistence playframework