我知道有一些关于这个的帖子,但它们大约一年没有回复.实际上我们在PostgreSQL 8.4上使用Hibernate 4.2.1.Final.我们有两个像这样的实体
实体A(顶级层次结构类)
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Polymorphism(type = PolymorphismType.EXPLICIT)
public class A {
@Id
@GeneratedValue
private Long id;
public A() {
}
public A(Long id) {
super();
this.id = id;
}
// Setters, getteres, hashCode and equals
}
Run Code Online (Sandbox Code Playgroud)
实体B(子类)
@Entity
public class B extends A{
String value;
public B(){
}
public B(String value) {
super();
this.value = value;
}
public B(Long id, String value) {
super(id);
this.value = value;
}
// Setters, getteres, hashCode and equals
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,实体使用注释 …