• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Lazy loading not working as expected

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am making use of hibernate3 and having the following code



Hibernate3 has lazy as true by default. I am executing the following code.



When the line



is executed, I get the following sql in my console



The first SQL is fine, but in case of 2nd query, the attendees is being fetched when the event method is called.
Accoring the lazy loading, it should not load the object when event is being accessed. Why is 2nd and 3rd SQL fetching the associated objects.
 
Naresh Chaurasia
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured out the problem. My config files were not using hibernate3, since it had wrong entry.

Old config file entry


New config file entry



On making use of new config file entry, the lazy loading works as expected.
reply
    Bookmark Topic Watch Topic
  • New Topic