Hibernate multi column discriminator
- by shikarishambu
I have a single lookup table that manages all lookups - legacy and new
lookup table structure is context,name, code, value
context is either legacy or new
name is the name of the lookup - state, status etc...for example
code is the code and value is the value associated with the code
Is there a way to specify multiple columns as discriminators so that I can get all legacy state code/values or all new status code/values. Is there a different way to do this if discriminators cannot do it?
<class name="com.company.domain.Lookup">
<id name="Id" column="id" type="big_integer">
<generator class="org.hibernate.id.TableHiLoGenerator" />
</id>
<discriminator column="context" insert="false" />
<property name="code" type="string"/>
<property name="value" type="string"/>
<property name="desc" type="string"/>
<subclass name="com.company.domain.LegacyLookup" discriminator-value="legacy">