Sunday, 6 October 2013

Mapping Class Inheritance in Hibernate

Hibernate has four different approach to represent an inheritance hierarchy.

  1. Table per concrete class with Implicit polymorphism : Use no explicit inheritance mapping and default runtime polymorphic behavior.
  2. Table per concrete class with unions : Discard polymorphism and inheritance relationship completely from the SQL schema
  3. Table per class hierarchy : Enable polymorphism by de-normalizing the SQL schema and utilizing a type discriminator column that holds that type information
  4. Table per subclass : Represent is a (inheritance) relationships as has a (foreign key) relationships. 


No comments:

Post a Comment