Hello
I got a problem during enabling caching for normal sql query using hibernate.
I did all configuration needed for enabling caching (EHCache) and it works correctly using hql (createQuery).
If i change query for normal sql query i got exception (ArrayIndexOutOfBound) like below.
Changing <prop key="hibernate.cache.use_query_cache">true</prop> to false there is no exception but also no caching ;).
Have you any idea to solve this problem?
Hibernate version:
3.1.3, 3.2.5.ga
Code between sessionFactory.openSession() and session.close():
***************
PROPERTIES
***************
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
***************
PROPERTIES
***************
hibernateSession.createSQLQuery("select * from cm_item_definitions").setCacheable(true).list();
Full stack trace of any exception that occurs:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.type.TypeFactory.disassemble(TypeFactory.java:451)
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:83)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2194)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2138)
at org.hibernate.loader.Loader.list(Loader.java:2096)
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:152)
Name and version of the database you are using:
postgres 8, oracle 9
The generated SQL (show_sql=true):
select * from cm_item_definitions
Thanks
Sebastian
|