我已阅读有关演进的文档,但Play框架2.4演进在我的项目中无效。要求确认sql脚本的消息没有出现,我不能创建脚本。我的模特,班级用户:
@Entity
@Table(name = "account")
public class User extends Model {
@Id
@Constraints.Required
@GeneratedValue(strategy = GenerationType.AUTO)
private String email;
@Constraints.Required
private String password;
@Constraints.Required
private String firstName;
@Constraints.Required
private String lastName;
@Constraints.Required
private String phone;
@ManyToOne
private Group group;
}
班组:
@Entity
@Table(name = "group")
public class Group extends Model {
@Id
@Constraints.Required
@GeneratedValue(strategy = GenerationType.AUTO)
public String name;
@OneToMany(mappedBy = "group")
public List<User> users = new ArrayList<>();
}
我已将此添加到build.sbt:
libraryDependencies ++= Seq(
evolutions,
javaJdbc,
cache,
javaWs,
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41"
)
这到application.conf:
# Ebean
ebean.default = ["models.*"]
# Evolutions
# ~~~~~
# You can disable evolutions if needed
play.evolutions.enabled=true
play.evolutions.autoApply=true
我的错误在哪里?
答案 0 :(得分:0)
不要将您的实体称为“用户”,它容易出错(许多dbs将其用于元数据)
答案 1 :(得分:0)
我已经解决了这个问题。我在模型上包模型。