Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-17418

[GSS](7.2.z) HHH-13586: ClassCastException when using a single region name for both entity and query results

XMLWordPrintable

      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(EnabledCaching.java:491)
              at org.hibernate.cache.internal.EnabledCaching.getQueryResultsCache(EnabledCaching.java:478)
              at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2515)
              at org.hibernate.loader.Loader.list(Loader.java:2498)
              at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:504)
              at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:395)
              at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:220)
              at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1508)
              at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1537)
              at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1505)
              at org.hibernate.query.Query.getResultList(Query.java:132)
              at org.jboss.as.jpa.container.QueryNonTxInvocationDetacher.getResultList(QueryNonTxInvocationDetacher.java:58)

              gbadner@redhat.com Gail Badner (Inactive)
              rhn-support-sfikes Stephen Fikes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: