Skip to content

Tag: java-persistence-api

Difference between FetchType LAZY and EAGER in Java Persistence API?

I am a newbie to Java Persistence API and Hibernate. What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API? Answer Sometimes you have two entities and there’s a relationship between them. For example, you might have an entity called University and another entity called Student and a University might have many Students: The University entity might have