-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem while Query Caching using EHCache
PostPosted: Tue Feb 27, 2007 2:12 am 
Newbie

Joined: Thu Feb 22, 2007 10:41 am
Posts: 2
Location: Pune
I am getting an ArrayIndexofBounds expection in org.hibernate.type.TypeFactory.disassemble(TypeFactory.java:416) while caching the query result in hibernate 3.1.2. I am using GWT, Spring and Hibernate on Tomcat 5.5 with Oracle 9 database.

The hibernate mapping, properties and echcache.xml are as follows :

[b]Hibernate version: 3.1.2[/b]

[b]Mapping documents:[/b]

<class name="com.audit.model.Audit"
table="WEB_AUDIT">
<cache usage="read-only" />
<id name="id" column="AUDIT_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">AUDIT_SEQ</param>
</generator>
</id>
<property name="eventType" column="EVENT_TYPE" update="false" />
<property name="application" column="APPLICATION"
update="false" />
<property name="description" column="DESCRIPTION"
update="false" />
<property name="expTimeDB" column="EXP_TIME" update="false" />
<property name="performedBy" column="AUDIT_OBJECT" update="false" />

<property name="loggedTime" column="LOGGED_TIME" insert="false"
update="false" />

</class>

[b]ehcache.xml[/b]

<ehcache>

<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120" />

<cache
name="query.GraphData"
maxElementsInMemory="2000"
eternal="false"
timeToLiveSeconds="60"
overflowToDisk="false" />

</ehcache>

[b]hibernate.properties[/b]

hibernate.cglib.use_reflection_optimizer=false
hibernate.cache.use_query_cache true
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.provider_configuration_file_resource_path=/ehcache.xml


[b]Code between sessionFactory.openSession() and session.close():[/b]

StringBuffer sql = new StringBuffer("select to_date(LOGGED_TIME, 'DD-MON-YYYY'), count(*) from WEB_AUDIT where 1=1 and LOGGED_TIME >= :fromDate AND LOGGED_TIME <= :toDate ");

// and many criterias ( like application and event) to add, if its speicified

Query query = getSession().createSQLQuery(sql.toString());

query.setCacheable(true);
query.setCacheMode(CacheMode.NORMAL);
query.setCacheRegion(AUDIT_GRAPH_CACHE_DATA);

List<AuditGraphModel> results = new ArrayList<AuditGraphModel>();


[b]Full stack trace of any exception that occurs:[/b]

I am getting the following exception :

2007-02-23 19:13:15,798 [DEBUG] rnate.cache.StandardQueryCache - checking cached query results in region: query.GraphData
2007-02-23 19:13:15,798 [DEBUG] org.hibernate.cache.EhCache - key: sql: select to_date(LOGGED_TIME, 'DD-MON-YYYY'), count(*) from WEB_AUDIT where 1=1 and lower(APPLICATION) like '%store%' and LOGGED_TIME >= ? and LOGGED_TIME <= ? group by to_date(LOGGED_TIME,'DD-MON-YYYY'); parameters: ; named parameters: {toDate=Fri Feb 23 00:00:00 IST 2007, fromDate=Thu Feb 01 00:00:00 IST 2007}
2007-02-23 19:13:15,798 [DEBUG] org.hibernate.cache.EhCache - Element for sql: select to_date(LOGGED_TIME, 'DD-MON-YYYY'), count(*) from WEB_AUDIT where 1=1 and lower(APPLICATION) like '%store%' and LOGGED_TIME >= ? and LOGGED_TIME <= ? group by to_date(LOGGED_TIME,'DD-MON-YYYY'); parameters: ; named parameters: {toDate=Fri Feb 23 00:00:00 IST 2007, fromDate=Thu Feb 01 00:00:00 IST 2007} is null
2007-02-23 19:13:15,798 [DEBUG] rnate.cache.StandardQueryCache - query results were not found in cache
Hibernate: select to_date(LOGGED_TIME, 'DD-MON-YYYY'), count(*) from WEB_AUDIT where 1=1 and lower(APPLICATION) like '%store%' and LOGGED_TIME >= ? and LOGGED_TIME <= ? group by to_date(LOGGED_TIME,'DD-MON-YYYY')
2007-02-23 19:13:17,281 [DEBUG] rnate.cache.StandardQueryCache - caching query results in region: query.GraphData
2007-02-23 19:13:17,521 [ERROR] .redhat.com].[/wapps/cservice] - Exception while dispatching incoming RPC call
java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.type.TypeFactory.disassemble(TypeFactory.java:416)
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:77)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2119)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2063)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1674)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:147)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at com.audit.hibernate.AuditDAOHibernate.getGraphData(AuditDAOHibernate.java:175)
at com.audit.manager.AuditManagerImpl.getGraphData(AuditManagerImpl.java:79)
at com.cservice.audit.gwt.server.FindAuditServiceImpl.getGraphRecordsCount(FindAuditServiceImpl.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:281)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:167)
at com.common.gwt.server.GWTAbstractServiceController.handleRequest(GWTAbstractServiceController.java:21)
......

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]
Oracle 9
[b]Debug level Hibernate log excerpt:[/b]

Waiting for a kind help.

regards,
Bakul.


Top
 Profile  
 
 Post subject: Re: Problem while Query Caching using EHCache
PostPosted: Fri Jul 10, 2009 3:31 am 
Newbie

Joined: Fri Jul 10, 2009 3:29 am
Posts: 2
I have the same problem, Have you solved it?
THanks a lot


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

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.