We have in our application the list of the documents(pdf,doc,xls) for the users to see. Also the use can upload the documents and search the documents. Now for the documents contents field I used LAZY loading so that when the list of the documents is presented to the user the contents of the documents should not be fetched. ONly when the documents link is clicked the contents be fetched.
But while navigation between different pages of documents I do not see considerable increase in performance of the application. It slows down when say in the upcoming list of the documents contents large documents.
How do I know that for a particular document or for all the documents lazy loading is performed. I mean how do I know tha contents are not loaded for the document.
I have read somewhere that LAZY loading is not guaranteed. I am using eclipselink.
Thanks and Regard,
With EclipseLink JPA you can enable SQL logging by setting the persistence.xml property,
This will give you a better idea of what is occurring.
In EclipseLink LAZY for OneToMany of ManyToMany is always supported. LAZY for OneToOne or ManyToOne requires that you use the EclipseLink agent is JSE (-javaagent:eclipselink.jar), or occurs automatically in JEE (provided the JEE server correctly supports EJB3). You can also use static weaving using the ant task provided by EclipseLink.
Note that EclipseLink enables caching by default, so if your object is already in the cache, you will not see any database access.