ClassCastException when using a single region name for both entity and query results in Hibernate

Solution In Progress - Updated -


  • Declared a named cacheable query for an entity and specifying the same region name for both the query and the entity.

    @NamedQuery(name = "Employee.findAll", query = "SELECT a FROM Employee a",
            hints = {
                    @QueryHint(name = "org.hibernate.cacheable", value = "true"),
                    @QueryHint(name = "org.hibernate.cacheRegion", value = "custom-region-01")
    @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region="custom-region-01")
  • When executing the named query the first time, the exception below is raised:

    ... java.lang.ClassCastException: org.infinispan.hibernate.cache.v53.impl.DomainDataRegionImpl cannot be cast to org.hibernate.cache.spi.QueryResultsRegion
        at org.hibernate.cache.internal.EnabledCaching.makeQueryResultsRegionAccess(
        at org.hibernate.cache.internal.EnabledCaching.getQueryResultsCache(
        at org.hibernate.loader.Loader.listUsingQueryCache(
        at org.hibernate.loader.Loader.list(
        at org.hibernate.loader.hql.QueryLoader.list(
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(
        at org.hibernate.engine.query.spi.HQLQueryPlan.performList(
        at org.hibernate.internal.SessionImpl.list(
        at org.hibernate.query.internal.AbstractProducedQuery.doList(
        at org.hibernate.query.internal.AbstractProducedQuery.list(
        at org.hibernate.query.Query.getResultList(


  • Red Hat JBoss Enterprise Application Platform (EAP) 7.2
  • Hibernate 5.3
  • Infinispan 9.3

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