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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content