Hibernate - Eager & Lazy
If you are not mentioning anything FetchType.LAZY is a default.
Eager:
Eager:
- It will load all the relationship tables.
Lazy:
- It will load only particular object instance.
- It will initialized when its explicitly called by getter methods (to fetch more tables)
Eg:
When loading login page, no need of user details tables, just we need user table to check the username & password. As we know to get all the relations is very expensive.
Comments
Post a Comment