nested exception is org.hibernate.MappingException: Named query not known:

my_x123 2009-07-10 10:51:22
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: Named query not known: select count(*) from (select m.cpuId cpuId, m.meterId meterId, cm.reading reading,cm.datetime datetime, o.Name operatorName,b.name buildingName,d.name departmentName, h.hNum hubId,h.Name hubName from Meter m, relationUserMeter rum, operators o, department d, relationBuildingMeter rbm, buildings b, Hubs h,(select r.cpuId,r.reading,r.dt datetime from readings r, (select cpuId, max(dt) datetime from readings group by cpuId) as temptable where r.cpuId=temptable.cpuId and r.dt=temptable.datetime) as cm where cm.cpuId=m.cpuId and m.cpuId=rum.cpuId and rum.operatorId=o.operatorId and o.departmentId=d.id and m.cpuId=rbm.cpuId and rbm.buildingId=b.id and cm.cpuId=rum.cpuId and cm.cpuId=rbm.cpuId and m.hub=h.hNum and h.hNum=?) a; nested exception is org.hibernate.MappingException: Named query not known: select count(*) from (select m.cpuId cpuId, m.meterId meterId, cm.reading reading,cm.datetime datetime, o.Name operatorName,b.name buildingName,d.name departmentName, h.hNum hubId,h.Name hubName from Meter m, relationUserMeter rum, operators o, department d, relationBuildingMeter rbm, buildings b, Hubs h,(select r.cpuId,r.reading,r.dt datetime from readings r, (select cpuId, max(dt) datetime from readings group by cpuId) as temptable where r.cpuId=temptable.cpuId and r.dt=temptable.datetime) as cm where cm.cpuId=m.cpuId and m.cpuId=rum.cpuId and rum.operatorId=o.operatorId and o.departmentId=d.id and m.cpuId=rbm.cpuId and rbm.buildingId=b.id and cm.cpuId=rum.cpuId and cm.cpuId=rbm.cpuId and m.hub=h.hNum and h.hNum=?) a
Caused by: org.hibernate.MappingException: Named query not known: select count(*) from (select m.cpuId cpuId, m.meterId meterId, cm.reading reading,cm.datetime datetime, o.Name operatorName,b.name buildingName,d.name departmentName, h.hNum hubId,h.Name hubName from Meter m, relationUserMeter rum, operators o, department d, relationBuildingMeter rbm, buildings b, Hubs h,(select r.cpuId,r.reading,r.dt datetime from readings r, (select cpuId, max(dt) datetime from readings group by cpuId) as temptable where r.cpuId=temptable.cpuId and r.dt=temptable.datetime) as cm where cm.cpuId=m.cpuId and m.cpuId=rum.cpuId and rum.operatorId=o.operatorId and o.departmentId=d.id and m.cpuId=rbm.cpuId and rbm.buildingId=b.id and cm.cpuId=rum.cpuId and cm.cpuId=rbm.cpuId and m.hub=h.hNum and h.hNum=?) a
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:899)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:897)
at com.ehongyue.commons.dao.impl.QuerySupportImpl.findPageByNamedQuery(QuerySupportImpl.java:36)
at com.ehongyue.commons.dao.impl.QuerySupportImpl.findPageByNamedQuery(QuerySupportImpl.java:28)
at com.qj.example.service.impl.HubManageServiceimpl.getList(HubManageServiceimpl.java:90)
at com.qj.example.service.impl.HubManageServiceimpl$$FastClassByCGLIB$$99f7e2a4.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:674)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:615)
at com.qj.example.service.impl.HubManageServiceimpl$$EnhancerByCGLIB$$8bd65cb3.getList(<generated>)
at com.qj.test.test.main(test.java:22)
...全文
727 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
usherlight 2009-07-10
  • 打赏
  • 举报
回复
你使用了一个namedQuery,但是却没有在配置文件中定义,所以报错了。
课程简介: 课程总计41课时,从什么是事务讲起,直到分布式事务解决方案,很的0基础基础与提升系列课程。对于难以理解的知识点,全部用画图+实战的方式讲解。 第一部分:彻底明白事务的四个特性:原子性、一致性、隔离性、持久性,用场景和事例来讲解。 第二部分:实战讲数据库事务的6中并发异常:回滚丢失、覆盖丢失、脏读、幻读、不可重复读、MVCC精讲。 第三部分:彻底搞清楚4种事务隔离级别:READ_UNCOMMITTED 读未提交隔离级别、READ_COMMITTED 读已提交隔离级别、REPEATABLE_READ 可重复度隔离级别、SERIALIZABLE 序列化隔离级别 第四部分:彻底搞清楚MySQL的各种锁:行锁、表锁、共享锁、排它锁、Next-Key锁、间隙锁、X锁、S锁、IS锁、IX锁、死锁、索引与锁、意向锁等。 第五部分:彻底搞清楚Spring事务的7种传播级别的原理和使用:PROPAGATION_REQUIRED、PROPAGATION_SUPPORTS、PROPAGATION_MANDATORY、PROPAGATION_REQUIRES_NEW、PROPAGATION_NOT_SUPPORTED、PROPAGATION_NEVER、PROPAGATION_NESTED分布式事务的理论基础:RPC定理、BASE理论、XA协议都是什么,原理是什么,有什么关联关系 第六部分:分布式事务的5种解决方案原理和优缺点:2PC两阶段提交法、3PC三阶段提交法、TCC事务补偿、异步确保策略、最大努力通知策略 第七部分:阿里巴巴分布式事务框架Seata:历经多年双十一,微服务分布式事务框架,用一个Nacos+Spring Cloud+Seta+MySql的微服务项目,实战讲解阿里的分布式事务技术,深入理解和学习Seata的AT模式、TCC模式、SAGA模式。 课程资料: 课程附带配套2个项目源码72页高清PDF课件一份阿里巴巴seata-1.1.0源码一份阿里巴巴seata-server安装包一份

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧