将JOINED播放Framework 2 Ebean和InheritanceType [英] Play Framework 2 Ebean and InheritanceType as JOINED

查看:121
本文介绍了将JOINED播放Framework 2 Ebean和InheritanceType的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google上进行了一些研究之后,我没有发现任何遇到问题的人,这就是为什么我将其发布在这里. 在我的应用程序中,我有三个实体:用户(抽象),客户,代理. 客户和代理商扩展了用户.这是User的代码:

After some research on Google, I haven't found anyone who has my problem that's why I'm posting it here. In my application I have three entities : User (abstract), Customer, Agency. Customer and Agency extends User. Here is the code of User :

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class User extends AbstractModel {

    @Column(unique = true)
    @NotNull
    @Email
    public String email;

    @NotNull
    public String password;

}

问题在于,生成的架构仅创建一个包含用户,客户和代理商字段的表,这通常是InheritanceType.SINGLE_TABLE的行为(默认).

The problem is that the generated schema creates only one table with the fields of User, Customer and Agency which is typically the behavior with InheritanceType.SINGLE_TABLE (default).

使用Ebean和@Inheritance注释是否有问题?我尝试了InheritanceType.TABLE_PER_CLASS,它也不起作用. 使用JPA,我从来没有遇到过这个问题.有人可以帮忙吗?

Is there any problem using Ebean and @Inheritance annotation ? I tried InheritanceType.TABLE_PER_CLASS, it didn't work either. I've never had this problem using JPA. Can anyone help ?

非常感谢;)

推荐答案

我更好地阅读了EBean的文档和限制:

I read better the documentation of EBean and limitations : http://ebean-orm.github.io/docs/mapping/jpa/

仅单个表继承

Only Single Table Inheritance

当前仅支持单表继承.另一个 两种继承策略被认为是增强请求和 将在功能版本中引入.

Current there is only support for single table inheritance. The other two inheritance strategies are considered Enhancement requests and will be introduced in a feature release.

这篇关于将JOINED播放Framework 2 Ebean和InheritanceType的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆