public
Created

  • Download Gist
GiftCard.hbm.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Company.Domain.Orders.GiftCard, Company.Domain" table="GiftCards">
<id name="GiftCardId" column="GiftCardId" type="Int32" unsaved-value="0">
<generator class ="native" />
</id>
<many-to-one name="Order" column="OrderId" class="Company.Domain.Orders.Order, Company.Domain" not-null="true" />
<property name="PIN" column="PIN" length="4" not-null="true" />
<property name="Number" column="Number" type="string" not-null="true" />
<property name="RedemptionAmount" column="RedemptionAmount" type="Company.Data.MoneyUserType, Company.Data" not-null="true" />
</class>
</hibernate-mapping>
Order.hbm.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Company.Domain.Orders.Order, Company.Domain" table="Orders" lazy="true">
<id name="OrderNumber" column="OrderId" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<!-- Some properties removed for brevity -->
<bag name="discounts" access="field" cascade="all-delete-orphan" lazy="true" inverse="true">
<key foreign-key="FK_OrderDiscounts_Orders" column="OrderId" />
<one-to-many class="Company.Domain.Orders.Discounts.OrderDiscount, Company.Domain" not-found="ignore" />
</bag>
<bag name="giftCards" access="field" cascade="save-update" lazy="true" inverse="true">
<key column ="OrderId" foreign-key="FK_GiftCards_Orders" />
<one-to-many class="Company.Domain.Orders.GiftCard, Company.Domain" />
</bag>
<bag name="orderItems" access="field" cascade="all-delete-orphan" lazy="true" inverse="true">
<key column ="OrderId" foreign-key="FK_OrderItems_Orders" />
<one-to-many class="Company.Domain.Cart.CartItem, Company.Domain" />
</bag>
<bag name="paymentMethods" access="field" cascade="all-delete-orphan" lazy="true" inverse="true">
<key column="OrderId" foreign-key="FK_PaymentMethods_Orders" />
<one-to-many class="Company.Domain.Orders.Payments.Payment, Company.Domain" />
</bag>
</class>
</hibernate-mapping>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.