67,513
社区成员
发帖
与我相关
我的任务
分享
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue(value = "Pet")
public class Pet{
private String type = this.getClass().getSimpleName();
}
@Entity
@DiscriminatorValue(value = "Dog ")
public class Dog extends Pet{
private String asdf;
}
@Entity
public class Master{
private Pet myPet;
}