ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 9.1.4\. 混合使用“每个类分层结构一张表”和“每个子类一张表” 你甚至可以采取如下方法混和使用“每个类分层结构一张表”和“每个子类一张表”这两种策略: ``` <class name="Payment" table="PAYMENT"> <id name="id" type="long" column="PAYMENT_ID"> <generator class="native"/> </id> <discriminator column="PAYMENT_TYPE" type="string"/> <property name="amount" column="AMOUNT"/> ... <subclass name="CreditCardPayment" discriminator-value="CREDIT"> <join table="CREDIT_PAYMENT"> <property name="creditCardType" column="CCTYPE"/> ... </join> </subclass> <subclass name="CashPayment" discriminator-value="CASH"> ... </subclass> <subclass name="ChequePayment" discriminator-value="CHEQUE"> ... </subclass> </class> ``` 对上述任何一种映射策略而言,指向根类`Payment`的 关联是使用`&lt;many-to-one&gt;`进行映射的。 ``` <many-to-one name="payment" column="PAYMENT_ID" class="Payment"/> ```