【发布时间】:2015-11-14 04:49:21
【问题描述】:
我有休眠实体,当我尝试将其插入 MySQL 数据库时出现异常:
@Entity
public class Pick {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int pid;
@OneToOne
private Match_soccer match;
@OneToOne
private Algo1 algo;
@Column(length = 100)
private String pick;
@Column(length = 5)
private double limit;
...
当我尝试使用休眠插入 MySQL 数据库时:
Pick pick = new Pick();
pick.setMatch(match);
pick.setAlgo(a);
pick.setLimit(2.5);
pick.setPick("under");
PickDAO pd = new PickDAO();
pd.insertMatch(pick);
我得到 MySQL 异常:
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 'limit, match_mid, pick) values (1, 2.5, 9358, 'under')' at line 1
【问题讨论】:
-
您是否尝试将变量名称
limit更改为其他名称? -
你能显示 insertMatch 方法吗?