EbeanORM does not support InheritanceType.TABLE_PER_CLASS. It is an outstanding enhancement request.
Ebean doesn't create the tables Needed for model inheritance (Play framework)
-
30-06-2023 - |
Frage
I have a User class, and three other classes inheriting from it: Employer, Student and Coordinator. This is my User class:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class User extends Model {
@Id
@GeneratedValue
public Long id;
public String username;
public String password;
public static Finder<Long, User> find = new Finder(Long.class, User.class);
public static User authenticate(String username, String password) {
return find.where().eq("username", username).eq("password", password).findUnique();
}
}
However, Ebean creates only one table, User, with all the data from the 4 classes combined. How can I make Ebean create one user table, one employer table etc.?
That's what I expected Ebean to do when I added the @Inheritance annotation. What am I doing wrong?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow