• 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

Question regarding Hibernate Lazy Loading

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

In one of the site i read that :

If you try to access an POJO that was not loaded with a Parent POJO in which the user'll get aLazyInitializationException.

and in another site it is

If you try to access an POJO that was not loaded with a Parent POJO the Hibernate Framework will then Load them actually from the DataBase

will you please tell me what is correct actually ??
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither really; both are potentially meaningless. Can you link to the sites? The quotes either look wrong or look like there may some missing detail.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the Hibernate session is open, when you load an object, when associated objects are loaded, Hibernate will pull them from the database. If the Session is closed, you will get a Lazy exception if the associated object had not been previously loaded.

-Cameron McKenzie
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Camer on Wallace McKenzie wrote:If the Hibernate session is open, when you load an object, when associated objects are loaded, Hibernate will pull them from the database. If the Session is closed, you will get a Lazy exception if the associated object had not been previously loaded.
-Cameron McKenzie



Cameron , Have you forgotten to use the word Not here " when associated objects are loaded"


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic