版权声明:本文为博主书香代码原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010138825/article/details/83109321
关于实体继承解决方式
@MappedSuperclass
public class AbstractEntity{
//子类都需要的字段可写在这里
@Column(length = 6)
private String name;
... ...
}
@Entity
@Table(name = "child")
public class ChildEntity extends AbstractEntity{
... ...
}
主键策略可参考:
https://blog.csdn.net/MJZ_CSDN/article/details/45024499?utm_source=blogxgwz1
https://blog.csdn.net/cooledi/article/details/78182135?utm_source=blogxgwz1