Lazy strategy is the default strategy for fetching entities and collections in Hibernate, and it is tightly related to Proxy.
For Example: User user = (User) session.load(User.class, id);
Then, the got user is actually not a USER, but a proxy acting like a user. Proxy is just a placeholder. When some properties(exception id) called for user, the proxy is initialized to a actual user(Here a execution of the SQL triggered).
However, If a get() method is used instead, then a DB hit always occurs. Then no proxy is used.
But, it is wrong to say Lazy strategy is not used for get.
If user has a collection(ex, friends), then the collection will also be lazy loaded.
TBD.
For Example: User user = (User) session.load(User.class, id);
Then, the got user is actually not a USER, but a proxy acting like a user. Proxy is just a placeholder. When some properties(exception id) called for user, the proxy is initialized to a actual user(Here a execution of the SQL triggered).
However, If a get() method is used instead, then a DB hit always occurs. Then no proxy is used.
But, it is wrong to say Lazy strategy is not used for get.
If user has a collection(ex, friends), then the collection will also be lazy loaded.
TBD.