Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

is LAZY loading guaranteed?

Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to all,

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,
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic