How to fetch multiple entities by id with Hibernate 5
| |

How to fetch multiple entities by id with Hibernate 5

It happens quite often that you have to load multiple entities by their primary keys. And new developers are often surprised when they learn that JPA and Hibernate versions before 5.1 do not offer a simple API for it. With JPA and older Hibernate versions, you have 2 options to fetch multiple entities from the database: You…

How to join unassociated entities with JPA and Hibernate
| |

How to join unassociated entities with JPA and Hibernate

Representing associations between entities as attributes is one of the most comfortable and popular features of JPA and Hibernate. It makes it very easy to navigate from one entity to one or more associated entities in your Java code, like from a Person entity to the corresponding Address entity. You can also use the association…