Search code examples
inheritanceplayframework-2.0ebeanjoined-subclass

Play Framework 2 Ebean and InheritanceType as JOINED


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;

}

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).

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 ?

Thanks a lot ;)


Solution

  • 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.