我得到了以下錯誤:Play Framework SQL演變腳本 - 整數列錯誤?
We got the following error: 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 'integer not null, constraint pk_checkpoint primary key (id))' at line 9 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:
生成的SQL:
1 # --- Rev:1,Ups - 491c235
2
3 create table checkpoint (
4 id bigint auto_increment not null,
5 name varchar(80) not null,
6 longitude double not null,
7 latitude double not null,
8 points integer not null,
9 message varchar(160) not null,
10 scenario_id bigint,
11 index integer not null,
12 constraint pk_checkpoint primary key (id))
13;
我的模型:
@Entity
public class Checkpoint extends Model {
@Id
public Long id;
@Column(length = 80, nullable = false)
public String name;
@Column(nullable = false)
public double longitude;
@Column(nullable = false)
public double latitude;
@Column(nullable = false)
public int points;
@Column(length = 160, nullable = false)
public String message;
@OneToMany(cascade = CascadeType.ALL)
public List<CheckpointAnswer> possibleAnswers = new ArrayList<CheckpointAnswer>();
@ManyToOne(cascade = CascadeType.PERSIST)
public Scenario scenario;
@Column(nullable = false)
public int index;
}
有什麼不對?
0123是索引是保留字,請嘗試稍微更改它。 – dwjv
謝謝,這解決了我的問題。 – pmichna