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)
1 个解决方案
#1
你使用了一个namedQuery,但是却没有在配置文件中定义,所以报错了。
#1
你使用了一个namedQuery,但是却没有在配置文件中定义,所以报错了。