What I did so far, was starting to map crom customer upwards (individual and corporate customer), this of course works and allowed me to refactor my app.
Now I have the need to retrieve [Accounts] from the db and still I cannot believe, that an abstract base class should be mapped discriminator based, I very much doubt it would work as well.
- abstract Account
- abstract Customer
- IndividualCustomer
- CorporateCustomer
- Administrator
like now I have this:
<class name="Customer" table="[User]" >
<id name="Id">
<generator class="identity" />
</id>
<discriminator column="Type" type="String" />
<property name="PrimaryTelephone" />
<column name="TelephoneOffice" />
</property>
<subclass discriminator-value="CorporateCustomer"></subclass>
<subclass discriminator-value="IndividualCustomer"></subclass>
</class>
I have trouble imaginating that this would work:
<class name="Account" table="[User]" >
<id name="Id">
<generator class="identity" />
</id>
<discriminator column="Type" type="String" />
<subclass discriminator-value="Customer">
<property name="PrimaryTelephone" />
<column name="TelephoneOffice" />
</property>
</subclass>
<subclass discriminator-value="CorporateCustomer"></subclass>
<subclass discriminator-value="IndividualCustomer"></subclass>
</class>
It's kind of non-sensical to put a discriminator for an abstract class mapping, there will never be a direct instance of Customer. It looks just wrong to map it that way.
Putting another discriminator into the Customer subclass already violates the mapping schema, so I am pretty positive, that trying to hack that together would be a waste of time.
Nobody ever came in contact with such a situation? How can I come around this?
--
Jan