I have read the documentation about evolutions, but Play framework 2.4 evolutions is not working in my project. The message that asks to confirm the sql script does not appear, and I can`t create script. My model, class User:
@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;
}
Class 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<>();
}
I have added this to build.sbt:
libraryDependencies ++= Seq(
evolutions,
javaJdbc,
cache,
javaWs,
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41"
)
And this to application.conf:
# Ebean
ebean.default = ["models.*"]
# Evolutions
# ~~~~~
# You can disable evolutions if needed
play.evolutions.enabled=true
play.evolutions.autoApply=true
Where is my mistake?
不要将您的实体称为“用户”,这很容易出错(许多数据库将其用于元数据)
I have solved this problem. I the package model on models .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.