一个既有继承关系,又有component的映射文件的示例

ProducedWare映射表productioninfo,然后其中有一个叫ProductionInfo得组件
 <class name="Ware" table="ware">
  <id name="id" type="string">
   <column name="ID" length="64" />
   <generator class="assigned" />
  </id>

  <property name="name" type="string">
   <column name="NAME" length="100" />
  </property>

  <joined-subclass name="ProducedWare" table="productioninfo">

   <key column="ID" />

   <component name="productionInfo" class="ProductionInfo">

    <many-to-one name="wareGroup" class="WareGroup" fetch="select">
     <column name="WAREGROUPID" length="64" />
    </many-to-one>

    <set name="factories" table="productiondetail" lazy="false">
     <key column="PRODUCEDWAREID" />
     <many-to-many class="Factory" column="FACTORYID" />
    </set>

   </component>

  </joined-subclass>
 </class>



你可能感兴趣的:(component)