Single Table Inheritance

Single table inheritance is a way to emulate object-oriented inheritance in a relational database. When mapping from a database table to an object in an object-oriented language, a field in the database identifies what class in the hierarchy the object belongs to.[1] All fields of all the classes are stored in the same table, hence the name "Single Table Inheritance". In Ruby on Rails the field in the table called 'type' identifies the name of the class. In Hibernate (Java) and Entity Framework this pattern is called Table-Per-Class-Hierarchy and Table-Per-Hierarchy (TPH) respectively.,[2][3] and the column containing the class name is called the Discriminator column.

See also

References

  1. Martin Fowler Patterns of Enterprise Application Architecture (2003), p. 278
  2. . Implementing Inheritance with the Entity Framework 6 in an ASP.NET MVC 5 Application (11 of 12), Retrieved November 3, 2015
  3. , Hibernate ORM documentation (5.0), Chapter 9. Inheritance mapping, Retrieved November 3, 2015

External links


This article is issued from Wikipedia - version of the Wednesday, November 04, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.