문제

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?

도움이 되었습니까?

해결책

EbeanORM does not support InheritanceType.TABLE_PER_CLASS. It is an outstanding enhancement request.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top