Use of the QueryPlanCache in Hibernate

Solution Verified - Updated -

Issue

  • Seeing QueryPlanCache memory allocated for each SessionFactory
Class Name                                                                        | Shallow Heap | Retained Heap
-----------------------------------------------------------------------------------------------------------------
org.hibernate.internal.SessionFactoryImpl @ 0x74d23b140                           |          144 |     8,567,184
|  ...
|- queryPlanCache org.hibernate.engine.query.spi.QueryPlanCache @ 0x74d8fe640     |           24 |       205,328
-----------------------------------------------------------------------------------------------------------------
  • JVM crashes because of "OutOfMemory" exceptions where significant memory is retained in the QueryPlanCache
  • Is the QueryPlanCache related to query (result) caching or level 2 caching?
  • Should we disable the QueryPlanCache?

Environment

  • Red Hat Enterprise Application Platform (EAP) 6
  • Hibernate 4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.