2013-10-10 168 views
0

添加新的列有3個表OrderProductOrderProductMapping表 那裏只有2實體clases是:OrderProduct OrderProduct表共享一個many-tomany關係。這意味着1個訂單可以有多個產品,一個產品可以屬於多個訂單。 並繪製這個,有一個名爲第三個表OrderProductMapping休眠:在連接表

下面是我從order.hbm文件

<set name="product" table="OrderProductMapping"> 
    <key column="orderId"/> 
    <many-to-many class="Product"> 
     <column name="productId" /> 
    </many-to-many> 
</set> 

下面的映射是從product.hbm文件映射

<set name="order" table="OrderProductMapping" inverse="true"> 
    <key> 
     <column name="orderId"/> 
    </key> 
    <many-to-many class="Product"> 
     <column name="productId" /> 
    </many-to-many> 
</set> 

現在我需要在映射表中引入一個新的列應該如何進行?任何幫助或指針都會很棒。

回答