FetchType: Lazy/Eager loading for Hibernate & JPA
|

FetchType: Lazy/Eager loading for Hibernate & JPA

Choosing the right FetchType is one of the most important decisions when defining your entity mapping. It specifies when your JPA implementation, e.g., Hibernate, fetches associated entities from the database. You can choose between EAGER and LAZY loading. The first one fetches an association immediately, and the other only when you use it. I explain…

How to Choose the Most Efficient Data Type for To-Many Associations – Bag vs. List vs. Set

How to Choose the Most Efficient Data Type for To-Many Associations – Bag vs. List vs. Set

Which data type should you use to map a to-many association with Hibernate? Is it better to use a Set or a List? That’s a very common question, and most developers are surprised when they look at the documentation and find out that these are not the only options. You can also use a Bag…