Message:
The following issue has been re-assigned.
Assignee: Gavin King (mailto:ga...@hi...)
---------------------------------------------------------------------
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: Open
Priority: Minor
Project: Hibernate2
Versions:
2.1 beta 6
Assignee: Gavin King
Reporter: Daniel Rosenbaum
Created: Mon, 1 Dec 2003 1:37 PM
Updated: Tue, 2 Dec 2003 7:53 PM
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
|