I am busy modeling a financial transaction system. In this system I
have types of financial transactions like payments (representing
purchases of an item) & refunds. Simple for this example.

I have modeled the domain like this so far:

Payment abstract class, inheriting from FinancialTransaction abstract
class.
Sub classes like CCPaymemt, CashPayment, EFTPayment inheriting from
Payment abstract class
Sub classes like CCRefund, CashRefund, EFTRefund inheriting from
Refund abstract class

FinancialTransaction abstract class with subclasses Payment & Refund

<img src="/blackdiamonddev.com/fin.png">

What is the best way to map this scenario. I have gone for table per
subclass and can map FinancialTransaction and Refund fine but am stuck
with the mapping of Payment and the related subclasses. I have
attached me hbm file.

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="BlackDiamond.Events.Domain"
                   namespace="BlackDiamond.Events.Domain">
  <class name="FinancialTransaction" table="FinancialTransaction" >

    <id name="Id">
      <generator class="guid.comb" />
    </id>

    <property name="TransactionDate" />
    <property name="GrossAmount" />

    <many-to-one
      name="RefFinancialTransaction"
      class="FinancialTransaction"
      column="RefFinancialTransactionId"
      cascade="delete"/>

    <joined-subclass name="Refund" table="Refund">
      <key column="Id"/>
      <property name="RefundReason" column="RefundReason" />
    </joined-subclass>

  </class>
</hibernate-mapping>

Hope this makes sense

S

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to