我使用與Hibernate春數據JPA和我有以下類JPA 2.0:嵌入式繼承抽象類
@Entity
@Table(name = "ORDER_SLIP")
public class OrderSlip {
@EmbeddedId
OrderNumber orderNumber;
@Embedded
OrderDetails orderDetails;
}
@Embeddable
public abstract class OrderDetail implements Serializable {
String commonOrderDetailField;
}
@Embeddable
public class BuyOrderDetail extends OrderDetail implements Serializable {
String field1;
String field2;
}
@Embeddable
public class SellOrderDetail extends OrderDetail implements Serializable {
String field3;
String field4;
}
當我運行該程序,OrderDetail類中的字段嵌入在ORDER_SLIP表。 OrderDetail(BuyOrderDetail和SellOrderDetail)這兩個子類的字段並不像我預期的那樣。
這對JPA/Hibernate來說可能嗎?
感謝您發表一個答案。您請描述鏈接的內容,而不是簡單地將鏈接作爲答案。 –