Play Framework - How to inherit from superclass?

本秂侑毒 提交于 2019-12-04 09:33:38
Samuel

To keep the User table concrete, you can use the @Inheritance annotation. See Play Framework 2 Ebean and InheritanceType as JOINED for a discussion about that.

Also possible is to manually join auxiliar tables for Drivers and Customers using @OneToOne.

Using @OneToOne would also be favor composition over inheritance, which is considered a good practice.

This might be an use case for the MappedSuperClass annotation. See http://docs.oracle.com/javaee/5/api/javax/persistence/MappedSuperclass.html for documentation. Presumably, this is suppoerted by Ebean, although there's a lack of documentation about it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!