Hibernate multi column discriminator

Posted by shikarishambu on Stack Overflow See other posts from Stack Overflow or by shikarishambu
Published on 2010-05-26T19:46:26Z Indexed on 2010/05/26 19:51 UTC
Read the original article Hit count: 234

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about mapping