Try this
<bag name="Items" >
<key column="POId"/>
<one-to-many class="PurchaseOrderItem" cascase="all"/>
</bag>
kind regards
On 28 jul, 03:26, Ian Escarro <[email protected]> wrote:
> I have an error in deleting a master/detail relationship. I have a
> PurchaseOrder class and a PurchaseOrderItem class. These are the mapping.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> namespace="Bogetz.Elephant.Model" assembly="elephant">
>
> <class name="PurchaseOrder" table="purchase_orders">
> <id name="Id">
> <generator class="native"/>
> </id>
> <property name="Date"/>
> <many-to-one name="Vendor" class="Vendor" column="VendorId"/>
> <bag name="Items" cascade="all">
> <key column="POId"/>
> <one-to-many class="PurchaseOrderItem"/>
> </bag>
> <property name="PreparedBy"/>
> <property name="ApprovedBy"/>
> <property name="ReferenceNo"/>
> </class>
>
> <class name="PurchaseOrderItem" table="purchase_order_items">
> <id name="Id">
> <generator class="native"/>
> </id>
> <many-to-one name="Order" class="PurchaseOrder" column="POId"/>
> <many-to-one name="Item" class="Item" column="ItemId"/>
> <property name="UnitPrice"/>
> <property name="Quantity"/>
> <property name="Amount"/>
> </class>
>
> </hibernate-mapping>
>
> and when I issue someSession.Delete(PurchaseOrder) it throws the exception
> above. I need help in finding the things I missed. Thanks in advance.
>
> ---
> Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---