Hi Ajse,
Lazy initialization is mostly used within a request, not across multiple requests.
Lazy initialization is basically used to make sure you retreive only what you want in a particular point in time. So if you have a collection inside the object and you do not plan to use the collection during a request, lazy loading will save unwanted database hits and memory usage as well. In case you plan to use the collection in the request, you will initialize that collection inside the same session for that request.
PS: You can use the same session across multiple requests also but generally, its not considered to be good practise.
_________________ Sukirtha
|