How to order entity subclasses by their class type using JPA and Hibernate

Introduction In this article, we are going to see how to order entity subclasses when executing a JPA query with Hibernate.

The best way to map the @DiscriminatorColumn with JPA and Hibernate

Introduction As previously explained, the SINGLE_TABLE inheritance is the most efficient entity inheritance strategy. However, for JPQL query such as this one: Hibernate generates a SQL query which filters by the associated discriminator column (e.g. DTYPE by default): So, because we are filtering by the discriminator column, we might want to index it or include it to speed up queries. However, the default STRING DiscriminatorType expects a VARCHAR column that must hold the longest entity subclass name. For the Announcement class, we need at least 12 bytes to store the entity class… Read More

Spring Boot Webinar
50 free licenses of Hypersistence Optimizer for my newsletter subscribers. The coupon goes out on 18 November. Subscribe