• Post Reply Bookmark Topic Watch Topic
  • New Topic

When to Use @DiscriminatorColumn Annotation?

Guy Yafe
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class named Attribute which basically has a uid, and type. (S, M, L for sizes, Square or Circle for shapes, etc.)
It is derived by a class named AttributeColor which also has an integer indicating the color.
Mapping them, I have a table called attributes and a table called attributes_colors. The inheritance is a 'Table Per Class' and annotated with @Inheritance(strategy = JOINED).
My question is if I have to use the @DiscriminatorColumn annotation? If so, this will of course require me to alter the tables themselves.
If I understand correctly, JOINED strategy doesn't require this annotation, but can make better performance.
So, when to use this annotation? How can it improve performance?

Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!