0

我想实现这个层次结构:

BaseOrder --> Order --> ConstOrder

我的映射:BaseOrder.hbm

<class name="BaseOrder, BackOffice.Core" abstract="true">
    <id name="Id" unsaved-value="0" type="int">
      <column name="id" not-null="true"/>
      <generator class="hilo">
        <param name="max_lo">0</param>
        <param name="where">table_name = 'orders'</param>
      </generator>
    </id>

</class>

订单.hbm

<union-subclass name="Order, Transport.Core" table="order" extends="BaseOrder, BackOffice.Core">
  <property name="PeopleNum">
    <column name="people_num" length="64"/>
  </property>      
</union-subclass>

ConstOrder.hbm

 <joined-subclass name="ConstOrder, Transport.Core" table="const_order" extends="Order, Transport.Core">
      <key column="Id"/>
      <property name="PeriodType">
        <column name="period_type"/>
      </property>
    </joined-subclass>

好的。我从每个具体类的表开始,以每个子类的表结束。我遇到了一些问题:

ICriteria criteria = session.CreateCriteria(typeof(ConstOrder));
return criteria.List<ConstOrder>() as List<ConstOrder>;

我的继承映射可能吗?我怎样才能只获得 ConstOrders?

4

1 回答 1

0

NH 不支持 mixin 继承策略。

于 2013-02-28T11:57:10.630 回答