A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

本帖最后由 杨兴庭 于 2013-7-22 21:25 编辑

hibernate中 ,使用createSQLQuery(sql)查询,在开启getHibernateTemplate().setCacheQueries(true);后,执行到query.list();报异常:java.lang.ArrayIndexOutOfBoundsException: 0
这个该怎么解决啊?
  1. 错误信息:
  2. java.lang.ArrayIndexOutOfBoundsException: 0
  3. at org.hibernate.type.TypeFactory.disassemble(TypeFactory.java:474)
  4. at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:104)
  5. at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2212)
  6. at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2163)
  7. at org.hibernate.loader.Loader.list(Loader.java:2121)
  8. at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
  9. at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1723)
  10. at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
  11. at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
  12. at com.wondertek.meeting.dao.impl.BaseDaoImpl$$2.doInHibernate(BaseDaoImpl.java:498)
  13. at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
  14. at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
  15. at com.wondertek.meeting.dao.impl.BaseDaoImpl.queryListSql(BaseDaoImpl.java:487)
  16. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  17. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  18. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  19. at java.lang.reflect.Method.invoke(Method.java:597)
  20. at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
  21. at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
  22. at com.guo.yf.service.impl.ChannelServiceImpl.getArticleNumByChannel(ChannelServiceImpl.java:56)
  23. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  24. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  25. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  26. at java.lang.reflect.Method.invoke(Method.java:597)
  27. at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
  28. at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
  29. at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
  30. at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
  31. at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
  32. at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
  33. at com.guo.yf.action.graphic.ChannelGraphicAction.genChannelNumBarChart(ChannelGraphicAction.java:41)
  34. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  35. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  36. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  37. at java.lang.reflect.Method.invoke(Method.java:597)
  38. at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)
  39. at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)
  40. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)
  41. at com.wondertek.meeting.interceptor.AnalyticsInterceptor.intercept(AnalyticsInterceptor.java:82)
  42. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  43. at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
  44. at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  45. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  46. at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
  47. at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
  48. at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  49. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  50. at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
  51. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  52. at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
  53. at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  54. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  55. at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
  56. at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
  57. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  58. at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
  59. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  60. at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
  61. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  62. at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
  63. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  64. at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
  65. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  66. at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
  67. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  68. at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
  69. at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
  70. at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
  71. at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:82)
  72. at org.mortbay.jetty.servlet.ServletHandler$$CachedChain.doFilter(ServletHandler.java:1157)
  73. at com.wondertek.meeting.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:60)
  74. at org.mortbay.jetty.servlet.ServletHandler$$CachedChain.doFilter(ServletHandler.java:1157)
  75. at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  76. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  77. at org.mortbay.jetty.servlet.ServletHandler$$CachedChain.doFilter(ServletHandler.java:1157)
  78. at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
  79. at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
  80. at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
  81. at org.mortbay.jetty.handler.ContextHandler.__handle(ContextHandler.java:765)
  82. at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java)
  83. at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
  84. at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
  85. at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
  86. at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
  87. at org.mortbay.jetty.Server.handle(Server.java:326)
  88. at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
  89. at org.mortbay.jetty.HttpConnection$$RequestHandler.headerComplete(HttpConnection.java:915)
  90. at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
  91. at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
  92. at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
  93. at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
  94. at org.mortbay.thread.QueuedThreadPool$$PoolThread.run(QueuedThreadPool.java:582)

复制代码

点评

对于能够提问入学之后的知识,是这都鼓励的,但是,请把问题说清楚  发表于 2013-7-21 19:15

3 个回复

倒序浏览
楼主,这是J2EE中的知识了,,这里是入学交流区我怕没有几个人能回答的了你这个问题,,,而且你只是把异常给列出来了,并没有给工程,,没法帮您Debug,你知道的Web开发中一个引号的丢失都会报很多的异常的。。我不能判定你的错误是否是query.list();报的异常
回复 使用道具 举报
杨兴庭 发表于 2013-7-21 12:53
楼主,这是J2EE中的知识了,,这里是入学交流区我怕没有几个人能回答的了你这个问题,,,而且你只是把异常 ...

好的,多谢
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马