• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

does lazy fetching use cache?

 
manuel aldana
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to avoid (unneccessarily) much data to be retrieved from database setting is done through lazy=true.

so if i for instance don't call any.getFoo(), no further SELECT is run. but what about the possible foo-state in cache (1st + 2nd level)? is the associated object foo still synchronized through the cache or do i have to call any.getFoo() explicity always?

thnx.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you access a association configured to use lazy initialization the association is fetched there and then, assuming it is not already in the cache. If it is in the cache those are the values used, and Hibernate won't query the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic