inheritance mapping
the three strategies:
table per class hierarchytable per subclasstable per concrete class
1.Table per class hierarchy
Suppose we have an interface Payment with the implementors CreditCardPayment and CashPayment. The table per class hierarchy mapping would display in the following way:
<class name="Payment" table="PAYMENT"><id name="id" type="long" column="PAYMENT_ID"><generator type="string"/><property name="amount" column="AMOUNT"/>...<subclass name="CreditCardPayment" discriminator-value="CREDIT"><property name="creditCardType" column="CCTYPE"/>...</subclass><subclass name="CashPayment" discriminator-value="CASH">...</subclass></class>
Exactly one table is required. There is one limitation of this mapping:columns declared by the subclass cannot have not null constraints.