Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4377

CLONE -HHH-5163 Bug when applying a ResultTransformer on a cacheable projection based criteria

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.0.GA_CP09, 4.3.0.GA_CP08, 4.3.0.GA_CP09
    • Fix Version/s: TBD EAP 4
    • Component/s: Hibernate
    • Labels:
      None
    • Affects:
      Release Notes
    • Release Notes Text:
      Hide
      When Hibernate executes a cacheable query using a <classname>ResultTransformer</classname>, it will attempt to cache the results after applying the <classname>ResultTransformer</classname>. However, the data may be modified so that Hibernate cannot read it. In this case, a <exceptionname>ClassCastException</exceptionname> will occur when attempting to cache the results.
      Show
      When Hibernate executes a cacheable query using a <classname>ResultTransformer</classname>, it will attempt to cache the results after applying the <classname>ResultTransformer</classname>. However, the data may be modified so that Hibernate cannot read it. In this case, a <exceptionname>ClassCastException</exceptionname> will occur when attempting to cache the results.
    • Release Notes Docs Status:
      Documented as Known Issue

      Description

      Typically following code will raise a CCE
      Criteria crit = session.createCriteria(MyEntity.class);
      crit.setProjection( Projections.projectionList()
      .add( Projections.alias(Projections.property("description"), "description" ))
      .add( Projections.alias(Projections.property("id"), "id" ))
      );
      crit.setCacheable(true);
      crit.setResultTransformer(Transformers.aliasToBean(MyEntity.class));
      List results = crit.list();

      java.lang.ClassCastException: org.hibernate.test.case756453.MyEntity
      at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:106)
      at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2208)
      at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2159)
      at org.hibernate.loader.Loader.list(Loader.java:2117)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)

      There is a problem between the real cached value and the expected cached value (maybe the transformer is applied too soon or query cache is not aware the cached value is already transformed,...).

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-5163

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                stliu Strong Liu
                Reporter:
                AnthonyHib Anthony Patricio
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: