• Post Reply Bookmark Topic Watch Topic
  • New Topic

When to Use @DiscriminatorColumn Annotation?  RSS feed

 
Guy Yafe
Greenhorn
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?

Guy
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!