nested exception is org.hibernate.MappingException解决方案

出错原因 

1.可能是因为映射文件( Order.hbm.xm)配置的class路径出错 

类的路径必须写全,或者在<hibernate-mapping>中加上属性package="com.web.bean" 

2.如果以上检查都是对的,那么就看applicationContext.xml中是否加上了 

阅读更多

扫码向博主提问

stujike123456

非学,无以致疑;非问,无以广识
去开通我的Chat快问
换一批

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

07-10

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=?) arnCaused 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=?) arn at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)rn at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1260)rn at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:899)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)rn at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:897)rn at com.ehongyue.commons.dao.impl.QuerySupportImpl.findPageByNamedQuery(QuerySupportImpl.java:36)rn at com.ehongyue.commons.dao.impl.QuerySupportImpl.findPageByNamedQuery(QuerySupportImpl.java:28)rn at com.qj.example.service.impl.HubManageServiceimpl.getList(HubManageServiceimpl.java:90)rn at com.qj.example.service.impl.HubManageServiceimpl$$FastClassByCGLIB$$99f7e2a4.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:674)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:615)rn at com.qj.example.service.impl.HubManageServiceimpl$$EnhancerByCGLIB$$8bd65cb3.getList()rn at com.qj.test.test.main(test.java:22)rn

没有更多推荐了,返回首页