【问题标题】:Ebean doesn't create the tables Needed for model inheritance (Play framework)Ebean 不创建模型继承所需的表(Play 框架)
【发布时间】:2014-04-09 12:37:14
【问题描述】:

我有一个 User 类,以及从它继承的三个其他类:Employer、Student 和 Coordinator。这是我的用户类:

@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();
    }
}

但是,Ebean 只创建了一个表 User,将 4 个类中的所有数据组合在一起。如何让 Ebean 创建一张用户表、一张雇主表等?

这就是我在添加@Inheritance 注释时期望Ebean 做的事情。我做错了什么?

【问题讨论】:

    标签: playframework playframework-2.2 ebean


    【解决方案1】:

    EbeanORM 不支持 InheritanceType.TABLE_PER_CLASS。这是一项出色的增强请求。

    【讨论】:

    • 那么我想要的实际上用 Ebean 是不可能的?我唯一的选择是在添加数据后立即拥有一个有很多漏洞的巨大用户表(因为我必须合并来自雇主、学生、用户和协调员的所有数据)?
    猜你喜欢
    • 2012-09-21
    • 2016-03-26
    • 1970-01-01
    • 2011-04-03
    • 2012-07-18
    • 2019-01-08
    • 2011-03-03
    • 2017-09-04
    • 1970-01-01
    相关资源
    最近更新 更多