我有以下的域對象我如何使用hibernate中的子類來獲取表中的屬性?
Loan {
int id;
Date attribute1;
}
LoanExtension {
Date attribute2;
}
我想保持這樣我的對象,因爲有時我想改變只在LoanExtension屬性在我的數據庫(即ATTRIBUTE1在貸款對象將在空該對象,我不想讓它在數據庫中設置)。
這是如何使用Hibernate映射與XML?我已經做了以下
<class name="org.domain.borrowerReview.Loan" table="loan_profiles" >
<cache usage="read-only"/>
<id name="loanId" column="id">
<generator class="native"/>
</id>
<version name="attribute1" column="date_1/>
<subclass name="org.domain.borrowerReview.LoanExtension" extends="org.rangde.domain.borrowerReview.LoanProfilesUpdate">
<property name="attribute2" column="date_2" />
</subclass>
</class>
我得到這個異常:當使用「單表每層次」需要 鑑別器和類有子類
http://stackoverflow.com/a/175046/169277 – ant 2012-04-20 08:25:29