我试图在数据库中保存一个简单的对象,但这给我带来了问题。
这是我的对象类:
@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
但我不知道在哪里可以查看我的日志,所以是否有人也可以告诉我?