• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Single Table Inheritance Type

 
Alpesh Rathod
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I want to know whether we can have getter and setter for the discriminator column like the one below..

@DiscriminatorColumn(name="skill_type",discriminatorType=DiscriminatorType.STRING) //part of a class

The below are the classes extending above class......having discriminator values as shown.

@DiscriminatorValue(value="Education")
@DiscriminatorValue(value="Training")
@DiscriminatorValue(value="Certification")
@DiscriminatorValue(value="Awards")

Now this values are set as soon as you create a new object of the respective classes...

Now suppose from the UI i want to search a person by a skill type like above ones.....then how can i do it ..since i dont have a getter or setter for skill_type attribute..i think its not possible...and if its possible what is the way???

Can I know how do we make a entity variable skill_type ??
 
Dragan Jovanovic
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just make a HQL query with a filter like ? In result list you will have only objects that you want, and there's no need to filter those objects again. Is this what you wanted ?

If it isn't, you can always ask for a class name of an object, using getClass() method, od instanceof operator, or something like that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic