[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-6681) ArrayIndexOutOfBoundsException on enabling cache for a Native SQL query

Gail Badner (JIRA) noreply at atlassian.com
Thu Oct 27 00:07:23 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-6681:
-----------------------------

    Fix Version/s:     (was: 3.6.8)
                   3.6.next

> ArrayIndexOutOfBoundsException on enabling cache for a Native SQL query
> -----------------------------------------------------------------------
>
>                 Key: HHH-6681
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6681
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: caching (L2)
>    Affects Versions: 3.6.7
>         Environment: Hibernate 3.6.7-Final
> ehcache 2.4.5
>            Reporter: Samuel Mendenhall
>             Fix For: 3.6.next
>
>
> String sql = "select (SELECT count(*) from kcs.dw_reports as k, kcs.dw_link_rate as lr where k.id = lr.master_report_id and k.kerberos_name = :username and k.active = true and k.span_identifier = :yearMonth) as total," +
> 				"(SELECT count(*) from kcs.dw_reports as k, kcs.dw_link_rate as lr where k.id = lr.master_report_id and k.kerberos_name = :username and k.active = true and k.span_identifier = :yearMonth  and lr.linked_to_doc_id IS NULL) as unlinked";
> 		
> try 
> {
> 	beginTransaction();
> 	results = getSession().createSQLQuery(sql)
> 		.setParameter("username", username)
> 		.setParameter("yearMonth", yearMonth)
> 		.setCacheable(true)
> 		.setReadOnly(true)
> 		.list();
> 	commitTransaction();
> } 
> catch (HibernateException e) 
> {
> 	rollbackTransaction();
> 	e.printStackTrace();
> 	log.error(e.getMessage());
> }
> Console log:
> Hibernate: 
>     select
>         (SELECT
>             count(*) 
>         from
>             kcs.dw_reports as k,
>             kcs.dw_link_rate as lr 
>         where
>             k.id = lr.master_report_id 
>             and k.kerberos_name = ? 
>             and k.active = true 
>             and k.span_identifier = ?) as total,
>         (SELECT
>             count(*) 
>         from
>             kcs.dw_reports as k,
>             kcs.dw_link_rate as lr 
>         where
>             k.id = lr.master_report_id 
>             and k.kerberos_name = ? 
>             and k.active = true 
>             and k.span_identifier = ?  
>             and lr.linked_to_doc_id IS NULL) as unlinked
> 21:01:42,284 ERROR ViewLinkRateService:40 - 0
> java.lang.ArrayIndexOutOfBoundsException: 0
> 	at org.hibernate.type.TypeHelper.disassemble(TypeHelper.java:146)
> 	at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:106)
> 	at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2434)
> 	at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2321)
> 	at org.hibernate.loader.Loader.list(Loader.java:2268)
> 	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
> 	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
> 	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
> 	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
> 	at com.jboss.support.server.KcsDao.getDwLinkRateNative(KcsDao.java:69)
> 	at com.jboss.support.server.KcsDao.getLinkRateDataTable(KcsDao.java:128)
> 	at com.jboss.support.server.service.ViewLinkRateService$2.run(ViewLinkRateService.java:31)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:680)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list