[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5163) ClassCastException when Hibernate tries to cache results using ResultTransformer

Gail Badner (JIRA) noreply at atlassian.com
Wed Jul 21 14:37:35 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-5163:
-----------------------------

    Fix Version/s:     (was: 3.5.x)

> ClassCastException when Hibernate tries to cache results using ResultTransformer
> --------------------------------------------------------------------------------
>
>                 Key: HHH-5163
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5163
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.1
>            Reporter: Strong Liu
>            Assignee: Gail Badner
>             Fix For: 3.6.x
>
>
> When Hibernate executes a cacheable query using a ResultTransformer, it will attempt to cache the results AFTER applying the ResultTransformer. The problem is that the ResultTransformer may modify the data in a way that Hibernate won't understand it anymore, and in this case it will generate a ClassCastException when trying to cache it.
> ---------------------------
> this can be reproduced by CriteriaQueryTest with following change: 
> papa-pc:testsuite stliu$ svn diff src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 
> Index: src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java 
> =================================================================== 
> --- src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java	(revision 19246) 
> +++ src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java	(working copy) 
> @@ -613,6 +613,7 @@ 
>  	 ) 
>  	 .addOrder( Order.desc("studentName") ) 
>  	 .setResultTransformer( Transformers.aliasToBean(StudentDTO.class) ) 
> +	 .setCacheable( true ) 
>  	 .list(); 
>  	
>  	 assertEquals(2, resultWithAliasedBean.size()); 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list