Hibernate: select users0_.id as id0_, users0_.username as username0_, users0_.password as password0_ from Users users0_
org.hibernate.MappingException: Unknown entity: java.lang.Integer
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1366)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:100)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:794)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:772)
at org.accp.ay213.dao.Impl.UserDaoImpl.deleteUser(UserDaoImpl.java:88)
at org.accp.ay213.services.Impl.UserservicesImpl.deleteUser(UserservicesImpl.java:33)
at org.accp.ay213.servlet.deleteUserInfo.doPost(deleteUserInfo.java:43)
at org.accp.ay213.servlet.deleteUserInfo.doGet(deleteUserInfo.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
at java.lang.Thread.run(Thread.java:619)
Hibernate: select users0_.id as id0_, users0_.username as username0_, users0_.password as password0_ from Users users0_
org.hibernate.MappingException: Unknown entity: java.lang.Integer
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1366)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:100)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:794)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:772)
at org.accp.ay213.dao.Impl.UserDaoImpl.deleteUser(UserDaoImpl.java:88)
at org.accp.ay213.services.Impl.UserservicesImpl.deleteUser(UserservicesImpl.java:33)
at org.accp.ay213.servlet.deleteUserInfo.doPost(deleteUserInfo.java:43)
at org.accp.ay213.servlet.deleteUserInfo.doGet(deleteUserInfo.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
at java.lang.Thread.run(Thread.java:619)
Hibernate: select users0_.id as id0_, users0_.username as username0_, users0_.password as password0_ from Users users0_
Hibernate: select users0_.id as id0_0_, users0_.username as username0_0_, users0_.password as password0_0_ from Users users0_ where users0_.id=?
目测是ORM的映射类型有误~~比如你DAO层的删除方法传入的参数类型有误???没看到你的DAO代码,所以难说,不过从报错信息看,十有八九是delete方法的参数有误!!
查之~~改之~~
回复 @我的中国梦:那么你的DAO方法里头,是否真的是接受int参数进行delete呢??~~~~另外如果你是采用hibernate自动生成DAO,那么更应该确认一下DAO的情况~~比如“getHibernateTemplate().delete()参数是一个pojo的实例”我穿的参数都是int类型的啊!我就在servlet里面有了一次string类型的转换,转换成了Integer。show_sql,看看打印出的SQL语句呗.还是JDBC好.Hibernate:selectusers0_.idasid0_,users0_.usernameasusername0_,users0_.passwordaspassword0_fromUsersusers0_应该是没找到要 删除的实体我用的是oracle,在oracle中id为number类型,我做删除是通过id来删除的,我就只在servlet里面做了一下转换integer。lz你是不是这样写的delete方法
session.delete(id)
Sessionsession=null;Usersuser=(Users)session.get(Users.class,id);session.delete(user);贴下你的代码啊
atorg.accp.ay213.dao.Impl.UserDaoImpl.deleteUser(UserDaoImpl.java:88)atorg.accp.ay213.services.Impl.UserservicesImpl.deleteUser(UserservicesImpl.java:33)atorg.accp.ay213.servlet.deleteUserInfo.doPost(deleteUserInfo.java:43)atorg.accp.ay213.servlet.deleteUserInfo.doGet(deleteUserInfo.java:35)这是你报错的代码位置。北大青鸟的项目???
session.delete(user);
这也报错啊!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。