From: <leg...@at...> - 2003-12-02 09:12:41
|
The following comment has been added to this issue: Author: Gavin King Created: Tue, 2 Dec 2003 3:11 AM Body: Yeah ok, I understand this (and what I have to do to fix it). I'll fix it for 2.1.1, not for 2.1 final. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-511 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-511 Summary: ClassCastException while caching queries with "select new..." Type: Bug Status: Unassigned Priority: Minor Project: Hibernate2 Versions: 2.1 beta 6 Assignee: Reporter: Daniel Rosenbaum Created: Mon, 1 Dec 2003 1:37 PM Updated: Tue, 2 Dec 2003 3:11 AM Environment: 2.1 beta 6 Description: I have code similar to the example from section 9.4 in the docs: Query query = HibernateSession.currentSession().createQuery( "select new Family(mother, mate, offspr) " + "from eg.DomesticCat as mother " + " join mother.mate as mate " + " left join mother.kittens as offspr"); query.setCacheable(true); query.setCacheRegion("FamilyQueryCache"); return query.list(); When this runs though I get the following exception: java.lang.ClassCastException: Family at net.sf.hibernate.cache.QueryCache.put(QueryCache.java:53) at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:967) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1483) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:45) seems that the code is trying to cast the Family object into an Object[]. The code works if I turn caching off. But if I try to cache a query that uses "select new ..." it generates this exception. Best regards, Daniel Rosenbaum --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |