问题描述:

I would like implement this hierarechy:

BaseOrder --> Order --> ConstOrder

My mappings:

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>

Order.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>

Ok. I start with Table per concrete class and finish with Table per subclass.

And I've got some problems with:

ICriteria criteria = session.CreateCriteria(typeof(ConstOrder));

return criteria.List<ConstOrder>() as List<ConstOrder>;

Is my inheritance mapping possible? How can I get only ConstOrders?

网友答案:

NH doesn't suport mixin inheritance strategies.

相关阅读:
Top