Hi,
I have created the mapping shown below between Invoice and InvoiceDetail. When trying to update an Invoice, I notice an update statement for User as well. Why should “User” be updated when we have set cascade ="none"?
<class name="Invoice" table="invoice" lazy="false">
<id name="InvoiceID" column="InvoiceID" type="int">
<generator class="native"/>
</id>
<property name="InvoiceDate" column="InvoiceDate" type="DateTime"></property>
<property name="InvoiceNo" column="InvoiceNo" type="String"></property>
<property name="TotalAmount" column="TotalAmount" type="Decimal"></property>
<many-to-one class=User" name="User" column="UserID" cascade ="none" />
<component name="InvoiceDetailList">
<bag name="items" table="invoicedetail" lazy="false" cascade="all-delete-orphan" access="field" inverse="true" >
<key column="InvoiceID" on-delete="cascade" />
<one-to-many class="InvoiceDetail"/>
</bag>
</component>
</class>
<class name="InvoiceDetail" table="invoicedetail" lazy="false">
<id name="InvoiceDetailID" column="InvoiceDetailID" type="int">
<generator class="native"/>
</id>
<property name="ProductID" column="EntityID" type="int"></property>
<property name="Quantity" column="Quantity" type="int"></property>
<property name="TotalPrice" column="TotalPrice" type="Decimal"></property>
<many-to-one class="Invoice" name="Invoice" column="InvoiceID" not-null="true"/>
</class>
Thanks
Anurag