How To Load Multiple Entities By Id
Description: This is a SpringBoot application that loads multiple entities by id via a @Query based on the IN operator and via the Hibernate 5 MultiIdentifierLoadAccess interface.
Key points:
- for using the
INoperator in a@Querysimply add the query in the proper repository - for using Hibernate 5
MultiIdentifierLoadAccessin Spring Data style provide the proper implementation - among its advantages, the
MultiIdentifierLoadAccessimplementation allows us to load entities by multiple ids in batches and by inspecting or not the current Persistent Context (by default, the Persistent Context is not inspected to see if the entities are already loaded or not)

