Skip to content

Files

Latest commit

 

History

History

HibernateSpringBootSingleTableInheritance

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

JPA Inheritance - SINGLE_TABLE

Description: This application is a sample of using JPA Single Table inheritance strategy (SINGLE_TABLE).

Key points:

  • this is the default inheritance strategy (@Inheritance(strategy=InheritanceType.SINGLE_TABLE))
  • all the classes in an inheritance hierarchy are represented via a single table in the database
  • subclasses attributes non-nullability is ensured via @NotNull and MySQL triggers
  • the default discriminator column memory footprint was optimized by declaring it of type TINYINT

Output example (below is a single table obtained from 3 entities):


If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices"If you need a hand of tips and illustrations of 100+ Java persistence performance issues then "Java Persistence Performance Illustrated Guide" is for you.