I tried to add <discriminator>:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="X" namespace="X.y">
<class name="RawAttachment" table="Metadata_Attachment">
<id name="AttachmentId">
<generator class="guid" />
</id>
<discriminator column="PAYMENT_TYPE" type="String"/>
<subclass
name="Attachment"
discriminator-value="Cash">
<property name="LocationId"/>
</subclass>
but got the following error:
The element ‘class’ in namespace ‘urn:nhibernate-mapping-2.2’ has
invalid child element ‘discriminator’ in namespace
‘urn:nhibernate-mapping-2.2’. List of possible elements expected:
‘property, many-to-one, one-to-one, component, dynamic-component,
properties, any, map, set, list, bag, idbag, array, primitive-array,
join, subclass, joined-subclass, union-subclass, loader, sql-insert,
sql-update, sql-delete, filter, resultset, query, sql-query’ in
namespace ‘urn:nhibernate-mapping-2.2’.
why?
found the answer: Move the tag to directly under the tag and before any tags.
https://forum.hibernate.org/viewtopic.php?p=2368742&sid=3af1d42a54dc239c8287f2bcec2d1412