Ternary Associations – Modelling Associations between 3 Entities

Ternary Associations – Modelling Associations between 3 Entities

An association between 3 entities is called a ternary association. A typical example is an association between an employee, the project they are working on, and their role in that project. If the role is a complex object, you might decide to model this as 3 entity classes. The association between them is the interesting…

Common Hibernate Exceptions Every Developer Must Know
|

Common Hibernate Exceptions Every Developer Must Know

Every framework has a set of exceptions that indicate common error scenarios. Understanding them will help you turn a task that could drag along for days into a quickly-implemented feature. When working with Hibernate, they tell you about issues with your database queries, mapping mistakes, and problems during write operations. In this article, I want…

Java Text Blocks – Using Multiline Strings with Hibernate & JPA
|

Java Text Blocks – Using Multiline Strings with Hibernate & JPA

JPA and Hibernate require you to write lots of Strings. You use them to create ad-hoc and named queries with JPQL, to define native SQL queries and to specify the fetching behavior in an EntityGraph. Until Java 13, the lack of multiline Strings in Java made all of these tasks either annoying to implement or…