Hi,
I've got a process that uses a StatelessSession to invoke many many native SQL queries. To simplify my code, i haven't used JDBC parameters - i've just included the parameters in the statement ie "SELECT a FROM b WHERE c=1" instead of "WHERE c=?".
Originally I planned to use plain JDBC for this, but i was assured that using hibernate would not add much overhead and since we use hibernate for the rest of the project it was simpler to continue configuring the persistence via hibernate.
It worked with the initial load, but have recently been ramping it up and running out of memory even with a 1g allocation.
I've used VisualVM to profile and have found that the culprit seems to be hibernate not de-referencing NativeSQLQueryPlan objects.
QUESTION: a) is there a way i can force hibernate to clear it's cache of Query Plans b) is there a way to disable caching of query plans? c) would using parameters in my queries solve the problem?
thanks, paul.
|