-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ClassCastException in StandardQueryCache
PostPosted: Wed Oct 11, 2006 6:25 am 
Newbie

Joined: Wed Oct 11, 2006 5:47 am
Posts: 1
Hi,

while using sql query, if the query has an "in or negated form" (i.e. if the sql query has "IN" or "NOT IN" clauses ) in it and if querycache is enabled and setCachable is made true, Hibernate framework throws a ClassCastException.
i.e. a query like
String queryString = "SELECT EMPNAME FROM EMP WHERE EMPID NOT IN('11','22')";
session.createSQLQuery(queryString).setCachable(true);

I have deployed my application on Jboss 4.0.4 and I am using hibernate 3.1.3. Hibernate is deployed as MBean and OSCache is used as second level cache. I have enabled query cache.

I have tested the scenario using hibernate-3.2.0.cr5 as well. But the problem persistes. The exception is originating from hibernate framework.

Here is the exception trace.

java.lang.ClassCastException
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:83)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2118)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2062)
at org.hibernate.loader.Loader.list(Loader.java:2020)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)


If I change the SQL to HQL as below.

queryString = "SELECT e.empname FROM Emp e WHERE e.empid NOT IN('11','22')");
session.createQuery(queryString).setCachable(true);
the query executes without any problem.

Also, If I disable querycache or remove setCacheable(true) then the query executes without any problem.

Am I missing something here? or is this a bug in hibernate framework?

Regards,
Teja


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.