• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable session cache for a query

 
sam bartl
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to disable hibernate session cache for one criteria query , can this be done ?








 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One option may be to first call the clear() method on your EntityManager instance, followed by createQuery() to execute your SQL.
 
sam bartl
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a webservice, when user calls this my concern is I should not end up with out of memory error because of hibernate session size.

my application uses OpenSessionInViewFilter, spring services , all service methods are annotated with @transaction.

here is the code of my webservice impl



in the above code stgAuditGeneralService is spring service , stgAuditGeneralService.findAudits() this internally calls doa and the dao calls a criteria query , so all the entities returned by the criteria query will be in hibernate session till the session is committed am I right ?

if my webservice caller passes 10,000 AuditSearchRequest then will my session grow very big and can end up with outofmemory error ?
please advice me.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic