• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Clear session in hibernate with spring

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone...

Apologies if the problem has already been discussed.

I'm refering to this thread:

https://coderanch.com/t/215788/Object-Relational-Mapping/java/Hibernate-cache

We are using Spring Framework 2.5 and Hibernate 3.3.1, using hibernateTemplate.

We are wondering if we use the appropriate way to clear the session cache when executing a query in a loop, so thanks for any suggestion.

The problem is the following: the details records are configured to be eagerly fetched. But when querying the master records in a loop, the details are cached - which is undesirable.

Clearing the session at the end of the query (session.clear()) solves this caching problem ... but is there a better way ?

Thanks for any input

Cheers - Nicolas Stern
 
Because those who mind don't matter and those who matter don't mind - Seuss. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic