Named query not known(解决)

Hibernate: select tuserrole0_.ROLEID as col_0_0_ from WTCX.T_USER_ROLE tuserrole0_ where (tuserrole0_.USERID=? )
Hibernate: Select functionid, funcode, parfuncode, rootcode, functionname, functiontitle, functionfile, functiontype, validated,  remarks, orders, addtime, edittime, addman, editman, expinfo1, expinfo2, expinfo3, expinfo4, expinfo5 From (Select b.*   From T_Function b  Where b.Functionid In (Select a.functionid From T_Role_Function a Where a.roleid In ('1','2')))  Start With Funcode = -1  Connect By Prior funcode = parfuncode
add param:String, -1
org.springframework.orm.hibernate3.HibernateSystemException: Named query not known: rankmanage.rankTree; nested exception is org.hibernate.MappingException: Named query not known: rankmanage.rankTree
Caused by: org.hibernate.MappingException: Named query not known: rankmanage.rankTree
 at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)
 at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1260)
 at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:909)
 at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
 at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:907)
 at cn.com.hd.common.dao.impl.BaseDAOImpl.querySQLByName(BaseDAOImpl.java:399)
 at cn.com.hd.common.dao.impl.BaseDAOImpl.querySQLByName(BaseDAOImpl.java:411)
 at cn.com.hd.zzjgManage.service.impl.RankManageServiceImpl.queryRankAndChildByRankcode(RankManageServiceImpl.java:166)
 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:589)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at $Proxy7.queryRankAndChildByRankcode(Unknown Source)
 at cn.com.hd.common.utils.maketree.RankTree.getRankData(RankTree.java:27)
 at cn.com.hd.common.utils.maketree.RankTree.getRankTree(RankTree.java:20)
 at cn.com.hd.zzjgManage.web.RankTreeBean.getTreeData(RankTreeBean.java:44)
 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:589)
 at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:457)
 at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
 at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
 at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
 at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
 at org.apache.myfaces.custom.tree2.UITreeData.getValue(UITreeData.java:267)
 at org.apache.myfaces.custom.tree2.UITreeData.getDataModel(UITreeData.java:399)
 at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeBegin(HtmlTreeRenderer.java:144)
 at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:515)
 at org.apache.myfaces.custom.tree2.UITreeData.encodeBegin(UITreeData.java:243)
 at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)
 at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_t_005ftree2_005f0(rankTreeNode_jsp.java:298)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_h_005fform_005f0(rankTreeNode_jsp.java:245)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_f_005fview_005f0(rankTreeNode_jsp.java:200)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspService(rankTreeNode_jsp.java:162)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
 at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
 at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at cn.com.hd.common.filter.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:59)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at cn.com.hd.common.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:45)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)
add param:String, -1
org.springframework.orm.hibernate3.HibernateSystemException: Named query not known: rankmanage.rankTree; nested exception is org.hibernate.MappingException: Named query not known: rankmanage.rankTree
Caused by: org.hibernate.MappingException: Named query not known: rankmanage.rankTree
 at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)
 at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1260)
 at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:909)
 at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
 at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:907)
 at cn.com.hd.common.dao.impl.BaseDAOImpl.querySQLByName(BaseDAOImpl.java:399)
 at cn.com.hd.common.dao.impl.BaseDAOImpl.querySQLByName(BaseDAOImpl.java:411)
 at cn.com.hd.zzjgManage.service.impl.RankManageServiceImpl.queryRankAndChildByRankcode(RankManageServiceImpl.java:166)
 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:589)
 at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at $Proxy7.queryRankAndChildByRankcode(Unknown Source)
 at cn.com.hd.common.utils.maketree.RankTree.getRankData(RankTree.java:27)
 at cn.com.hd.common.utils.maketree.RankTree.getRankTree(RankTree.java:20)
 at cn.com.hd.zzjgManage.web.RankTreeBean.getTreeData(RankTreeBean.java:44)
 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:589)
 at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:457)
 at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
 at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
 at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
 at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
 at org.apache.myfaces.custom.tree2.UITreeData.getValue(UITreeData.java:267)
 at org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeChildren(HtmlTreeRenderer.java:169)
 at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
 at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:483)
 at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:364)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_t_005ftree2_005f0(rankTreeNode_jsp.java:298)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_h_005fform_005f0(rankTreeNode_jsp.java:245)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspx_meth_f_005fview_005f0(rankTreeNode_jsp.java:200)
 at org.apache.jsp.pages.privsystree.rankTreeNode_jsp._jspService(rankTreeNode_jsp.java:162)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
 at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
 at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at cn.com.hd.common.filter.SessionTimeoutFilter.doFilter(SessionTimeoutFilter.java:59)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at cn.com.hd.common.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:45)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:619)



**************************************************************************
解决:
        是要将sql语句文件(sqlRankTree.hbm.xml)配置到当前的spring文件中
        <value>cn/com/hd/purview/sqlconfig/sqlRankTree.hbm.xml</value>


posted on 2008-08-25 16:08 鲁胜迪 阅读(6663) 评论(6)  编辑  收藏

评论

# re: Named query not known(解决) 2008-09-25 21:18 sdsss

等于没说
  回复  更多评论   

# re: Named query not known(解决) 2008-09-25 21:19 sdsss

sql是写在代码里的  回复  更多评论   

# re: Named query not known(解决) 2008-11-04 18:59 xiaozi

我也遇到了相同的问题,我真的很想知道答案,我的项目碰到了,我真的很急啊,希望那位高人能帮帮我啊
  回复  更多评论   

# re: Named query not known(解决) 2009-01-12 23:35 shuaige

说的个锤子!!!!SPRING配置文件少了那句话,不会报你那个错!!!!  回复  更多评论   

# re: Named query not known(解决) 2009-01-13 09:33 鲁胜迪

@shuaige
请问那我这个错误是因为什么造成的?
当我没有将sql语句文件(sqlRankTree.hbm.xml)配置到当前的spring文件中
时报出了这个错误,但是当我进行了以上配置之后就没有报错了,所以我得出了以上结论。
如果你认为我的观点不对,可以将正确的观点说出来,这样才能让人信服,这样才是讨论!不要一上来就什么“锤子”的。  回复  更多评论   

# re: Named query not known(解决) 2010-03-09 15:22 sonnow

<query name="User.listAll"><![CDATA[
from User u order by u.account desc
]]></query>在实体的xml文件中,在找anotation配置方法  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问  
 
<2009年1月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

导航

统计

常用链接

留言簿(4)

随笔分类

随笔档案

文章分类

新闻分类

搜索

最新评论

阅读排行榜

评论排行榜