Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Hibernate: How to set multiple values for <subclass discriminator-value...

Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My requirement is to use a specific class type when the value is one in an integer value range or of the set of values. I tried finding out if discriminator-value allows to have an integer range or list of values but haven't got any success in it. Here is my hbm.xml mapping file:

<discriminator column="<db_column_name>" type="integer" />

<subclass name="somepackage.someclassA" discriminator-value="1">

<subclass name="somepackage.someclassB" discriminator-value="2-8">

<subclass name="somepackage.someclassC" discriminator-value="9,10">

Last two classes should be interpreted as either or. I felt that the solution is available but I don't exactly know how to implement it. Here is the link to the "solution" Any help is appreciated.
    Bookmark Topic Watch Topic
  • New Topic