我试图保存在数据库中的简单对象,但它给我的问题。发挥架构JPA问题与保存()
这是我的对象类:
@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
但我不知道我在哪里可以查看我的日志,所以如果有人能告诉我这些呢?