JPA/HIBERNATE Entity 从两个继承而来类
JPA / HIBERNATE Entity from two inherited classes
有人能帮我举个例子/想法如何处理这种情况吗?
我有 class Animal 和 class Cat ,它们扩展了 Animal。
在 Animal 中我有一些字段,在我的 Cat class.
中也有一些新字段
所以我必须创建休眠实体,将我的猫存储在数据库中,并以某种方式获得有关 parents 字段的信息。
使用注解@Inherance
与
strategy=InheritanceType.ONLY_ONE_TABLE (or SINGLE_TABLE)
strategy=InheritanceType.TABLE_PER_CLASS
strategy=InheritanceType.JOINED
有人能帮我举个例子/想法如何处理这种情况吗?
我有 class Animal 和 class Cat ,它们扩展了 Animal。
在 Animal 中我有一些字段,在我的 Cat class.
中也有一些新字段
所以我必须创建休眠实体,将我的猫存储在数据库中,并以某种方式获得有关 parents 字段的信息。
使用注解@Inherance
与
strategy=InheritanceType.ONLY_ONE_TABLE (or SINGLE_TABLE)
strategy=InheritanceType.TABLE_PER_CLASS
strategy=InheritanceType.JOINED