程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> hibernate-用hql語句刪除的時候執行dao層方法報這個錯誤,哪位大神幫我分析下錯誤原因,多謝

hibernate-用hql語句刪除的時候執行dao層方法報這個錯誤,哪位大神幫我分析下錯誤原因,多謝

編輯:編程綜合問答
用hql語句刪除的時候執行dao層方法報這個錯誤,哪位大神幫我分析下錯誤原因,多謝

org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown entity: java.util.ArrayList
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:683) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:837) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:833) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at com.sunyard.audit.model.modelplat.TranCodeDAO.delete(TranCodeDAO.java:41) ~[TranCodeDAO.class:na]
at com.sunyard.audit.model.modelplat.TranCodeDAO$$FastClassByCGLIB$$7fffcc57.invoke() [cglib-nodep-2.2.2.jar:na]
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [cglib-nodep-2.2.2.jar:na]
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) [spring-tx-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at com.sunyard.audit.model.modelplat.TranCodeDAO$$EnhancerByCGLIB$$82df1988.delete() [cglib-nodep-2.2.2.jar:na]
at com.sunyard.audit.service.ModelSetService.isEmpty(ModelSetService.java:2729) [ModelSetService.class:na]
at com.sunyard.audit.service.ModelSetService$$FastClassByCGLIB$$9179a7b.invoke() [cglib-nodep-2.2.2.jar:na]
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [cglib-nodep-2.2.2.jar:na]
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) [spring-tx-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622) [spring-aop-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at com.sunyard.audit.service.ModelSetService$$EnhancerByCGLIB$$edc70d4.isEmpty() [cglib-nodep-2.2.2.jar:na]
at com.sunyard.audit.struts.ModelSetAction.managerEntrySetting(ModelSetAction.java:686) [ModelSetAction.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_02]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_02]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_02]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_02]
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270) [struts.jar:1.2.9]
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187) [struts.jar:1.2.9]
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) [struts.jar:1.2.9]
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) [struts.jar:1.2.9]
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts.jar:1.2.9]
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) [struts.jar:1.2.9]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) [servlet-api.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:na]
at com.sunyard.audit.filter.LoginFilter.doFilter(LoginFilter.java:80) [LoginFilter.class:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:na]
at com.sunyard.audit.filter.EncodingFilter.doFilter(EncodingFilter.java:43) [EncodingFilter.class:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:na]
at com.sunyard.audit.filter.EncodingFilter.doFilter(EncodingFilter.java:43) [EncodingFilter.class:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:na]
at com.sunyard.audit.filter.ResourceCacheFilter.doFilter(ResourceCacheFilter.java:125) [ResourceCacheFilter.class:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) [catalina.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:na]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:na]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:na]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) [catalina.jar:na]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:na]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:na]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) [catalina.jar:na]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857) [tomcat-coyote.jar:na]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565) [tomcat-coyote.jar:na]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509) [tomcat-coyote.jar:na]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_02]
Caused by: org.hibernate.MappingException: Unknown entity: java.util.ArrayList
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:514) ~[hibernate3.jar:na]
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1302) ~[hibernate3.jar:na]
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:59) ~[hibernate3.jar:na]
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:761) ~[hibernate3.jar:na]
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:739) ~[hibernate3.jar:na]
at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:843) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ~[spring-orm-3.1.0.RELEASE.jar:3.1.0.RELEASE]
... 58 common frames omitted
09:42:49 c.s.a.s.BaseAction ERROR - Unknown entity: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown entity: java.util.ArrayList
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown entity: java.util.ArrayList
Caused by: org.hibernate.MappingException: Unknown entity: java.util.ArrayList

最佳回答:


刪除方法傳的參數不對。getHibernateTemplate().delete() 方法,參數是要刪除的實體對象。你應該把實體列表遍歷再單個傳入刪除。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved