🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 9.2\. 限制 对“每个具体类映射一张表”(table per concrete-class)的映射策略而言,隐式多态的 方式有一定的限制。而`<union-subclass>`映射的限制则没有那 么严格。 下面表格中列出了在Hibernte中“每个具体类一张表”的策略和隐式多态的限制。 **表 9.1\. 继承映射特性(Features of inheritance mappings)** | 继承策略(Inheritance strategy) | 多态多对一 | 多态一对一 | 多态一对多 | 多态多对多 | 多态 `load()/get()` | 多态查询 | 多态连接(join) | 外连接(Outer join)读取 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 每个类分层结构一张表 | `<many-to-one>` | `<one-to-one>` | `<one-to-many>` | `<many-to-many>` | `s.get(Payment.class, id)` | `from Payment p` | `from Order o join o.payment p` | _支持_ | | 每个子类一张表 | `<many-to-one>` | `<one-to-one>` | `<one-to-many>` | `<many-to-many>` | `s.get(Payment.class, id)` | `from Payment p` | `from Order o join o.payment p` | _支持_ | | 每个具体类一张表(union-subclass) | `<many-to-one>` | `<one-to-one>` | `<one-to-many>` (仅对于`inverse="true"`的情况) | `<many-to-many>` | `s.get(Payment.class, id)` | `from Payment p` | `from Order o join o.payment p` | _支持_ | | 每个具体类一张表(隐式多态) | `<any>` | _不支持_ | _不支持_ | `<many-to-any>` | `s.createCriteria(Payment.class).add( Restrictions.idEq(id) ).uniqueResult()` | `from Payment p` | _不支持_ | _不支持_ |