• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clear session in hibernate with spring

 
Nicolas Stern
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone...

Apologies if the problem has already been discussed.

I'm refering to this thread:

http://www.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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic