| Author |
disable session cache for a query
|
sam bartl
Greenhorn
Joined: Oct 29, 2010
Posts: 26
|
|
I want to disable hibernate session cache for one criteria query , can this be done ?
|
 |
Koen Aerts
Ranch Hand
Joined: Feb 07, 2012
Posts: 339
|
|
|
One option may be to first call the clear() method on your EntityManager instance, followed by createQuery() to execute your SQL.
|
 |
sam bartl
Greenhorn
Joined: Oct 29, 2010
Posts: 26
|
|
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.
|
 |
 |
|
|
subject: disable session cache for a query
|
|
|