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

出错原因 

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

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

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

求助:nested exception is org.hibernate.MappingException

07-25

大家帮我看看这个是什么问题呢,被这个问题搞迷糊了,呵呵rnrnHTTP Status 500 - rnrn--------------------------------------------------------------------------------rnrntype Exception reportrnrnmessage rnrndescription The server encountered an internal error () that prevented it from fulfilling this request.rnrnexception rnrnjavax.servlet.ServletException: Unknown entity: com.hanke.service.entity.muju; nested exception is org.hibernate.MappingException: Unknown entity: com.hanke.service.entity.mujurn org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: com.hanke.service.entity.muju; nested exception is org.hibernate.MappingException: Unknown entity: com.hanke.service.entity.mujurn org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:658)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:377)rn org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)rn com.hanke.service.dao.mujuDAO.save(mujuDAO.java:11)rn com.hanke.service.biz.mujuBiz.save(mujuBiz.java:27)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:585)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)rn org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn $Proxy1.save(Unknown Source)rn com.hanke.struts.action.LoginAction.execute(LoginAction.java:56)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnroot cause rnrnorg.hibernate.MappingException: Unknown entity: com.hanke.service.entity.mujurn org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:514)rn org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1302)rn org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)rn org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)rn org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)rn org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)rn org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)rn org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)rn org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:635)rn org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)rn org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:632)rn com.hanke.service.dao.mujuDAO.save(mujuDAO.java:11)rn com.hanke.service.biz.mujuBiz.save(mujuBiz.java:27)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:585)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)rn org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn $Proxy1.save(Unknown Source)rn com.hanke.struts.action.LoginAction.execute(LoginAction.java:56)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnrnnote The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/5.5.20rnrn 论坛

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 论坛

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