-
-
Save stanb/24150513ef8650220bb4 to your computer and use it in GitHub Desktop.
Map supplier-orders model with <bag>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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