首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

inheritance 地图ping

2012-10-07 
inheritance mappingthe three strategies:table per class hierarchytable per subclasstable per concre

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.

热点排行