我有休眠的實體,當我嘗試將其插入到MySQL數據庫我得到異常:Java的Hibernate的異常MySQLSyntaxErrorException:您在您的SQL語法錯誤
@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;
...
,當我嘗試使用Hibernate插入到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方法嗎? – PatrykG