Skip to content

Instantly share code, notes, and snippets.

@stanb
Created November 2, 2012 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stanb/24150513ef8650220bb4 to your computer and use it in GitHub Desktop.
Save stanb/24150513ef8650220bb4 to your computer and use it in GitHub Desktop.
Map supplier-orders model with <bag>
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHTests" namespace="NHTests">
<class name="Supplier" table="Suppliers">
<id name="Id">
<generator class="guid" />
</id>
<property name="Name" length="100" />
<bag name="Orders" cascade="all-delete-orphan" inverse="true" >
<key column="SupplierId" />
<one-to-many class="SupplierOrder" />
</bag>
</class>
<class name="SupplierOrder" table="SupplierOrders" >
<id name="Id">
<generator class="guid" />
</id>
<many-to-one name="Supplier" class="Supplier" column="SupplierId" />
<property name="OrderTime" />
</class>
</hibernate-mapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment