Quote:
<class name="Document" table="DOCUMENTS">
<id name="id">...</id>
<discriminator column="TYPE" type="string"/>
...
<subclass name="Book" discriminator-value="BOOK"/>
<subclass name="Newspaper" discriminator-value="NEWSPAPER"/>
<subclass name="XML" discriminator-value="XML">
<join table="XML_DOCUMENTS">
....
</join>
</subclass>
</class>
Can I choose the discriminator column from another table, for instance:
]<class name="Document" table="DOCUMENTS">
<id name="id">...</id>
<discriminator type="string"
formula = "(Select a.Name from A a where a.id = id)" />
<subclass name="Book" discriminator-value="BOOK"/>
<subclass name="Newspaper" discriminator-value="NEWSPAPER"/>
<subclass name="XML" discriminator-value="XML">
<join table="XML_DOCUMENTS">
....
</join>
</subclass>