Unknown entity异常 [问题点数:30分,结帖人u011931519]

Bbs1
本版专家分:0
结帖率 100%
Bbs6
本版专家分:7167
Bbs6
本版专家分:7108
Blank
黄花 2013年8月 Oracle大版内专家分月排行榜第二
Blank
蓝花 2012年5月 Oracle大版内专家分月排行榜第三
Bbs1
本版专家分:0
Bbs1
本版专家分:0
Bbs6
本版专家分:7108
Blank
黄花 2013年8月 Oracle大版内专家分月排行榜第二
Blank
蓝花 2012年5月 Oracle大版内专家分月排行榜第三
could not initialize :no session
http://hi.baidu.com/hzeewpeffeacyze/item/19aa91285368670f73863e77
MappingException: Unknown entity解决方案
学习: http://jingyan.baidu.com/article/e75aca8552761b142edac6cf.html 1.使用注解的时候没有导入正确的包 com.<em>entity</em>下的类的注解有误
org.hibernate.MappingException: Unknown entity
<em>异常</em>分析:hibernate映射<em>异常</em>,从hibernate加载顺序入手,查看配置文件,结果bean对象的映射给注释掉了。 去掉注释,成功运行。
could not initialize proxy - no Session
在中这错误很常见,字面意义就是不能被初始化,因为session已经关闭了。简单理解就是因为,你使用了lazy=true,这样hibernate在从数据库中调数据的时候是不会把关联的对象查出来的,而是保存一个获取值得方法,在你使用getXXX()调用的时候,hiberante会利用这个保存的方法去从数据库中取数据。而往往我们在jsp页面中使用getXXX()准备展示数据的时候,session早已经在
EntityUtils.toString(entity)
原来是html = EntityUtils.toString(<em>entity</em>);这句导致了后面的写入文件错误.<em>entity</em>所得到的流是不可重复读取的也就是说所得的到实体只能一次消耗完,不能多次读取,所以在执行html = EntityUtils.toString(<em>entity</em>)后,流就关闭了,就导致后面的读和写显示错误.
Caused by: org.hibernate.MappingException: Unknown entity:异常
ssh框架做的项目中,DAO文件等都是用hibernate自动生成的。rn当我点击页面上的添加按钮时:却出现了这个<em>异常</em>;rn请问是怎么回事rnrnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.ghtn.techschool.struts.action.BaseTable1_10Action.invoke(BaseTable1_10Action.java:96)rn at com.ghtn.techschool.struts.action.BaseTable1_10Action.init(BaseTable1_10Action.java:51)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)rn at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)rn at com.ghtn.techschool.struts.action.BaseTable1_10Action.execute(BaseTable1_10Action.java:34)rn at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)rn at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.ghtn.techschool.system.TestFilter.doFilterHttp(TestFilter.java:178)rn at com.ghtn.techschool.system.TestFilter.doFilter(TestFilter.java:193)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)rn at java.lang.Thread.run(Thread.java:619)rnCaused by: org.hibernate.MappingException: Unknown <em>entity</em>: com.ghtn.techschool.<em>entity</em>s.Markpercentrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:68)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)rn at com.ghtn.techschool.dao.MarkpercentDAO.findById(MarkpercentDAO.java:58)rn ... 35 morernhttp://127.0.0.1:8080/TechSchool/
org.hibernate.MappingException: Unknown entity的问题
在hibernate下,数据DAO里写User instance = (SystemUser) session.get("User", id);rn会报错org.hibernate.MappingException: Unknown <em>entity</em> Userrn而给User加上包名,写成User instance = (SystemUser) session.get("com.test.User", id);就可以,这个是怎么原因?带上包名很麻烦的,有没有什么配置方法?rn
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: Use
小弟初学ssh2,配置一则User的增删查改实例,遇到如下问题,求高手解决:rnexception rnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: User; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: Userrn org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)rn org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:532)rn org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:526)rn com.tribesoft.dao.UserDAO.findById(UserDAO.java:64)rn com.tribesoft.service.UserService.updateUser(UserService.java:31)rn com.tribesoft.action.UserAction.updateUser(UserAction.java:76)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn java.lang.reflect.Method.invoke(Unknown Source)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rnrnroot cause rnorg.hibernate.MappingException: Unknown <em>entity</em>: Userrn org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)rn org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)rn org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)rn org.hibernate.impl.SessionImpl.get(SessionImpl.java:843)rn org.springframework.orm.hibernate3.HibernateTemplate$2.doInHibernate(HibernateTemplate.java:538)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn org.springframework.orm.hibernate3.HibernateTemplate.
NHibernate Unknown entity class?
配置文件(我用的sql2008)rn[code=XML]rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn[/code]rnrn[code=C#]rnrn if (factory == null)rn rn Configuration cfg = new Configuration();rn string connectionStringName = cfg.Properties["connectionStringName"].ToString();rn cfg.Properties.Add("hibernate.connection.connection_string", System.Configuration.ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString);rn cfg.AddAssembly("NHibernate.Factory");//rn rn factory = cfg.BuildSessionFactory();rn logger = LogManager.GetLogger("HibernateDAL");rn rnrnrnrnrnusing (ISession session = factory.OpenSession())rn rn using (ITransaction transaction = session.BeginTransaction())rn rn tryrn rn session.SaveOrUpdate(model);//[color=#FF0000]出现错误:Unknown <em>entity</em> class[/color]rn transaction.Commit();rn rn catch (Exception ex)rn rn transaction.Rollback();rn logger.Error("插入model时失败:" + model, ex);rn rn rn rnrn[/code]rnrnrn
Unknown entity: java.lang.String
这个问题有很多种,而我遇到这只是针对我这种的解决方案,仅此以供参考! Unknown <em>entity</em>: java.lang.String ERRORDefaultDispatcherErrorHandler:42 - Exception occurred during processingrequest: Unknown <em>entity</em>: java.lang.String; nested
关于SSH异常unknown entity
看到许多解决方案,大致都是一样的。1、import javax.persistence.Entity;注解@<em>entity</em>导包应该导这个。2、没加入映射文件。我的是Spring整合了hibernate所以没有hibernate的cfg文件。而是包扫描,扫描的路径写错也会导致这个<em>异常</em>。...
请教JPA的一个Unknown entity问题
DB Table: CREATE TABLE .( NOT NULL, (32) NOT NULL, (256) NULL, CONSTRAINT PRIMARY KEY CLUSTERED ( AS
org.hibernate.MappingException: Unknown entity: java.util.ArrayList问题求解决
执行删除的时候页面报错 org.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: java.util.A
org.hibernate.MappingException: Unknown entity 解决方法
spring 管理hibernate,可是总是报错,无法创建数据库。纠结很长时间,还以为自己的配置出了问题。 最后发现时Entity 这个注解出的问题 import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import org.hibernate
java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ 解决方案
//第一个<em>异常</em> Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the dri...
mysql max_allowed_packet 设置过小导致记录写入失败
mysql根据配置文件会限制server接受的数据包大小。 有时候大的插入和更新会受max_allowed_packet 参数限制,导致写入或者更新失败。 查看目前配置 show VARIABLES like '%max_allowed_packet%'; 显示的结果为: +--------------------+---------+ | Vari...
springMVC中Unknown return value type: java.lang.Integer(解决)
controller层返回值类型为int,然而报 Unknown return value type: java.lang.Integer
c3p0連接池配置
最近試用了c3p0數據庫連接池,配置方式使用的是propery文件,將c3p0.properties放在classpath目錄下,如果為WEB應用,放在WEB-INF\classes下   # # This file is detritus from various testing attempts # the values below may change, and often d...
Unknown entity class 错误
我在使用NHibernate过程中:rn[code=C#]rn School school = new School();rn school.SchoolName = TextBox2.Text;rn school.SchoolAddress = TextBox3.Text;rn school.HeadMaster = TextBox4.Text;rn school.SchoolId = TextBox1.Text;rn NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();rn cfg.AddAssembly("Coln.Net.MyNHibernate");rn ISessionFactory factory = cfg.BuildSessionFactory();rn ISession s = factory.OpenSession();rn ITransaction t = s.BeginTransaction();rn s.Save(school);//程序在这里出错rn t.Commit();rn[/code]rn出现:Unknown <em>entity</em> class 错误rnxml文件我已经设置了嵌入的资源
org.hibernate.MappingException: Unknown entity: com.yourcompany.struts.form.InfoForm
struts+hibernate,在页面上输入信息,提交到到数据库中,再要代码如下:rn1)页面代码省略,已证实无错;rn2)Action(struts)主要相关代码:InfoForm infoForm = (InfoForm) form;rn UserDAO ud=new UserDAO();rn ud.insertUser(infoForm);rn3)Form(struts)代码,和就定义,get和set,没什么特别;rn4)UserDAO(hibernate)中insertUser方法代码:public void insertUser(InfoForm form)rn Session session=sessionFactory.openSession();rn Transaction tx=null;rn tryrn tx=session.beginTransaction();rn session.save(form);rn tx.commit();rn catch(Exception e)rn System.out.println("shujuchucuo"+e);rn finallyrn session.close();rn rn rn5)其他自动生成.rn出错如题: shujuchucuoorg.hibernate.MappingException: Unknown <em>entity</em>: com.yourcompany.struts.form.InfoForm
hibernate:Unknown entity问题
严重: Servlet.service() for servlet action threw exceptionrnorg.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Integerrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:514)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1302)rn at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:59)rn at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:761)rn at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:739)rn at org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:790)rn at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)rn at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784)rn at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780)rn at com.abby.dao.impl.GuestbookDaoImpl.delete(GuestbookDaoImpl.java:14)rn at com.abby.service.impl.GuestbookManagerImpl.delete(GuestbookManagerImpl.java:18)rn at com.abby.struts.action.GuestbookAction.delete(GuestbookAction.java:92)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn 急!请大家帮帮忙呀!!!!!
org.hibernate.MappingException: Unknown entity: java.lang.String
[color=#FF0000][b]急、急、急...[/b][/color]rnrn增、查、改都没问题,就是删除报错:[color=#FF0000]org.hibernate.MappingException: Unknown <em>entity</em>: java.lang.String[/color],请高手赐教...rnrn[b]User.hbm.xml文件如下:[/b]rn[code=XML]rnrn rn //主键studentIdrn rn rn rn rn rn rn rn rn rn rnrn[/code]rn[b]JAVA类删除方法[/b]rn[code=Java]rnpublic void delete(String studentId) rn Session session=HibernateUtil.getSession();rn session.beginTransaction();rn session.delete(studentId);rn session.getTransaction().commit();rn HibernateUtil.closeSession(session);rn rn[/code]rn[b]表的映射类User.java[/b]rn[code=Java]rnpublic class User rn private String studentId,name,password;rnrn public String getStudentId() rn return studentId;rn rnrn public void setStudentId(String studentId) rn this.studentId = studentId;rn rnrn public String getName() rn return name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn public String getPassword() rn return password;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrnrn[/code]
使用Hibernate操作,出现Unknown entity异常
大家好,刚接触配置类的东西,好多依葫芦画瓢,没弄懂。这次碰上一个东西,直接闷了,麻烦大家帮我看下。 applicationContext.xml 配置文件中,我添加了一行代码。 s
Spring和Hibernate结合出现Unknown entity: java.lang.String
第一次发帖,如果有什么规矩不知道,请大家包含。这是我用spring和hibernate整合时出现的错误,上网找了很多,有说数据库表错误的,有说主键类型不是int的,但是我实在解决不了,所以来此求助,请
Unknown entity:
在网上找到的大多数的解决办法都是导包问题和mapping配置问题两种,但是并不合适 最终解决的办法是因为自己的hibernate版本是5.2,在创建sessionfactory 时使用了 //Configuration config = new Configuration().configure();         //ServiceRegistry serviceRegistry = n
hibernate Unknown entity异常解决方案
po 居然找不到 搞了半天 然后发现改动过扫描hibernate的实体的路径   &amp;lt;bean id=&quot;revitbusSessionFactory&quot; class=&quot;org.springframework.orm.hibernate4.LocalSessionFactoryBean&quot;&amp;gt; &amp;lt;property name=&quot;dataSource&quot; ref=&quot;revitbus...
hibernate Unknown entity: com.test.bean.XXX
出现这个问题是配置文件的事,请仔细xml配置文件。我花了几小时解决这个问题。详情请看这 hibernate配置
Hibernate (Unknown entity: java.util.HashSet)
以下是会用到的文件,比较多,麻烦大家了。主要是我这里面有四个表,有一个没有关系的我就没写出来,我现在contact表没办法生成,报错是 Unknown <em>entity</em>: java.util.HashSet ,不知道是哪里错了…… 以及配置文件配没配错……rn麻烦了。rnrn[color=#FF0000]contact.hbm.xml[/color]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[color=#FF0000]contactgroup.hbm.xm;[/color]rnrnrnrn rn rn rn rn rn rn rn rn rn rnrnrnphonenumber.hbm.xml[color=#FF0000][/color]rnrnrnrnrn rn rn rn rn rn rn rn rn rnrnrn[color=#FF0000]rnDAOcontact.java[/color]rnrnpackage domain;rnrnimport java.util.HashSet;rnimport java.util.Set;rnrnimport org.hibernate.Session;rnrnimport util.HibernateUtil;rnrnrnpublic class DAOContact rn String Street,City,Zip,Country,phoneKind1, phoneKind2, phoneKind3, phoneNumber1, phoneNumber2, phoneNumber3,group,group1;rn rn public DAOContact(String Street,String City,String Zip,String Country,String phoneKind1, String phoneKind2, String phoneKind3, String phoneNumber1, String phoneNumber2, String phoneNumber3,String group,String group1)rn this.Street = Street;rn this.City = City;rn this.Zip = Zip;rn this.Country = Country;rn this.phoneKind1 = phoneKind1;rn this.phoneKind2 = phoneKind2;rn this.phoneKind3 = phoneKind3;rn this.phoneNumber1 = phoneNumber1;rn this.phoneNumber2 = phoneNumber2;rn this.phoneNumber3 = phoneNumber3;rn this.group=group;rn this.group1=group1;rn rn rn public void addContact(long id, String firstName, String lastName, String emailC )rn Session session = null;rn rn tryrn session = HibernateUtil.getSessionFactory().openSession();rn rn org.hibernate.Transaction tx = session.beginTransaction();rn rn Contact contact = new Contact();rn Address add=new Address(Street, City, Zip, Country); rn PhoneNumber pho1=new PhoneNumber(phoneKind1,phoneNumber1);rn PhoneNumber pho2=new PhoneNumber(phoneKind2,phoneNumber2);rn PhoneNumber pho3=new PhoneNumber(phoneKind3,phoneNumber3);rn ContactGroup gro=new ContactGroup(group);rn ContactGroup gro1=new ContactGroup(group1);rn Set phone =new HashSet();rn Set groups = new HashSet();rn Set contacts = new HashSet();rn rn contact.setIdcontact(id);rn contact.setFirstName(firstName);rn contact.setLastName(lastName);rn contact.setEmail(emailC);rn rn contact.setAddress(add);rn phone.add(pho1);rn phone.add(pho2);rn phone.add(pho3);rn groups.add(gro);rn groups.add(gro1);rn contact.setPhonenumber(phone);rn contact.setContactgroups(groups);rn session.save(phone);rn session.save(add);rn session.save(contact);rn rn tx.commit();rn rn System.out.println("Done");rn catch (Exception e)rn System.out.println(e.getMessage());rn rn finallyrn rn session.close();rn rn rn rnrnrnrn[color=#FF0000]rncontact.java[/color]rnrnpackage domain;rnrnimport java.util.HashSet;rnimport java.util.Set;rnrnpublic class Contact rn rn long idcontact;rn String firstName;rn String lastName;rn String email;rn rn rn Set contactgroups = new HashSet();rn Address address;rn Set phonenumber =new HashSet();rn rn public Contact() rn // TODO Auto-generated constructor stubrn rn rn public Contact(long idContact, String firstName, String lastName,rn String email) rn super();rn this.idcontact = idContact;rn this.firstName = firstName;rn this.lastName = lastName;rn this.email = email;rn rnrn public long getIdcontact() rn return idcontact;rn rnrn public void setIdcontact(long id_contact) rn this.idcontact = id_contact;rn rnrn public String getFirstName() rn return firstName;rn rnrn public void setFirstName(String firstName) rn this.firstName = firstName;rn rnrn public String getLastName() rn return lastName;rn rnrn public void setLastName(String lastName) rn this.lastName = lastName;rn rnrn public String getEmail() rn return email;rn rnrn public void setEmail(String email) rn this.email = email;rn rnrn public Address getAddress() rn return address;rn rnrn public void setAddress(Address address) rn this.address = address;rn rnrn public Set getContactgroups() rn return contactgroups;rn rnrn public Set getPhonenumber() rn return phonenumber;rn rnrn public void setPhonenumber(Set phonenumber) rn this.phonenumber = phonenumber;rn rnrn public void setContactgroups(Set contactgroups) rn this.contactgroups = contactgroups;rn rnrnrn[color=#FF0000]contactgroup.java[/color]rnrnpackage domain;rnrnimport java.util.HashSet;rnimport java.util.Set;rnrnpublic class ContactGroup rn rn long idgroup;rn String groupName;rn rn Set contacts = new HashSet();rn rn public ContactGroup()rn rn rnrn public ContactGroup(String groupName) rn super();rn this.groupName = groupName;rn rnrn public long getIdgroup() rn return idgroup;rn rnrn public void setIdgroup(long id_group) rn this.idgroup = id_group;rn rnrn public String getGroupName() rn return groupName;rn rnrn public void setGroupName(String groupName) rn this.groupName = groupName;rn rnrn public Set getContacts() rn return contacts;rn rnrn public void setContacts(Set contacts) rn this.contacts = contacts;rn rn rn rnrnrnrn[color=#FF0000]phonenumber.java[/color]rnrnpackage domain;rnrnrnpublic class PhoneNumber rn rn long idphone;rn String phoneKind;rn String phoneNumber;rn Contact contact;rn rn public PhoneNumber()rn rn rnrn public PhoneNumber(String phoneKind, String phoneNumber) rn super();rn this.phoneKind = phoneKind;rn this.phoneNumber = phoneNumber;rnrn rnrn public long getIdphone() rn return idphone;rn rnrn public void setIdphone(long id_phone) rn this.idphone = id_phone;rn rnrn public String getPhoneKind() rn return phoneKind;rn rnrn public void setPhoneKind(String phoneKind1) rn this.phoneKind = phoneKind1;rn rnrn public String getPhoneNumber() rn return phoneNumber;rn rnrn public void setPhoneNumber(String phoneNumber1) rn this.phoneNumber = phoneNumber1;rn rn rn rn public Contact getContact() rn return contact;rn rnrn public void setContact(Contact contact) rn this.contact = contact;rn rnrnrnrnrnrn以上是会用到的文件,比较多,麻烦大家了。主要是我这里面有四个表,有一个没有关系的我就没写出来,我现在contact表没办法生成,报错是 Unknown <em>entity</em>: java.util.HashSet ,不知道是哪里错了…… 以及配置文件配没配错……rn麻烦了。
org.hibernate.MappingException: Unknown entity: com.yourcompany.struts.model.Stu
myeclipse做程序我写了个保存功能 程序跑到DaoHibwernate就报错了rn错误如下:rnrnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: com.yourcompany.struts.model.StuNew; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: com.yourcompany.struts.model.StuNewrnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: com.yourcompany.struts.model.StuNew; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: com.yourcompany.struts.model.StuNewrnorg.hibernate.MappingException: Unknown <em>entity</em>: com.yourcompany.struts.model.StuNewrnrnrnDaoHibernate里的代码:rnrnrnrnpublic void save(StuNew stuNew) rn rn try rn[color=#FF0000] 到这里就开始出错:Unknown <em>entity</em>: com.yourcompany.struts.model.StuNewrn[/color] getHibernateTemplate().save(stuNew); rn getHibernateTemplate().flush();rn catch (Exception e) rn log.error(e, e);rn rn rnrnrnrnmodel的代码如下:rnrnrnrnrnrnrn rn rn rn STU_NEWrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnrnrnrnrn我应该怎么改啊!???????????????????????
orm.hibernate3.HibernateSystemException: Unknown entity: java.lang.Long;
<em>异常</em>为: org.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: java.lang.Long; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Longrnrn 配置文件: rn rn rn rn rn   实体rn private Long id;rn public Long getId() rn return id;rn rn public void setId(Long id) rn this.id = id;rn rn然后dao实现: rn public void delPerson(long personId) rn this.getHibernateTemplate().delete(personId);rn rnrnrn方法为:rn public ActionForward deletperson(ActionMapping mapping, ActionForm actionfrom,rn HttpServletRequest request, HttpServletResponse response) throws IllegalAccessException, InvocationTargetException rn PersonForm perform=(PersonForm)actionfrom; rn Person person=new Person();rn BeanUtils.copyProperties(person, perform);rn personManager.delPerson(person.getId());rn return queryall( mapping, actionfrom,request, response);rn rn rnrn另外,getHibernateTemplate().find和getHibernateTemplate().save 也就是查询和保存方法都可以正常执行
hibernate5.0.6报错Unknown entity
网上这个错误的解决方法很多,我都试过了但是没有一个行的,确认我的配置文件没写错,请问是什么问题?rn**报错**rnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: com.hibernate.Studentrn at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:781)rn at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1520)rn at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)rn at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:177)rn at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)rn at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:679)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666)rn at com.hibernateservice.StudentTest.main(StudentTest.java:33)rn**hibernate.cfg.xml:**rn```rn rnrnrn rn com.mysql.jdbc.Driverrn 1234rn jdbc:mysql://localhost:3306/hibernatern rootrn rn org.hibernate.dialect.MySQL5Dialectrn truern updatern rn rnrn```rn**Student.hbm.xml**rnrnrn```rn rnrnrnrn rn rn rn rn rn rnrnrn```rn**Student.java:**rnrnrn```rn package com.hibernate;rnrnpublic class Student rnrn int id;rn String name;rn rn /**rn * @return the idrn */rn public long getId() rn return id;rn rnrn /**rn * @param id the id to setrn */rn public void setId(int id) rn this.id = id;rn rnrn /**rn * @return the namern */rn public String getName() rn return name;rn rnrn /**rn * @param name the name to setrn */rn public void setName(String name) rn this.name = name;rn rn rn public Student() rn // TODO Auto-generated constructor stubrnrn rnrnrnrn```rn**StudentTest.java:**rnrnrn```rn package com.hibernateservice;rnimport com.hibernate.Student;rnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnimport org.hibernate.cfg.Configuration;rnrnpublic class StudentTest rnrn public StudentTest() rn // TODO Auto-generated constructor stubrn rn rn public static void main(String[] args) rn rn Configuration config = new Configuration().configure();rn rn org.hibernate.service.ServiceRegistry registry = rn new StandardServiceRegistryBuilder().applySettings(config.getProperties()).build();rn rn SessionFactory sessionFactory = config.buildSessionFactory(registry);rn Session session = sessionFactory.openSession();rn session.beginTransaction();rn rn Student s = new Student();rn s.setName("张三");rn s.setId(0);rn session.save(s);rn rn session.getTransaction().commit();rn session.close();rn sessionFactory.close();rn rnrnrnrn```rn**目录:**rn![图片说明](https://img-ask.csdn.net/upload/201512/23/1450800820_219127.png)rnrnrnrn
org.hibernate.MappingException: Unknown entity: com.kaxaka.exam.bean.User
严重: Servlet.service() for servlet springmvc threw exceptionrnorg.hibernate.MappingException: Unknown <em>entity</em>: com.kaxaka.exam.bean.Userrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:172)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)rn at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:686)rn at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:683)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:683)rn at com.kaxaka.exam.dao.impl.UserDaoImpl.addUser(UserDaoImpl.java:20)rn at com.kaxaka.exam.service.impl.UserServiceImpl.addUser(UserServiceImpl.java:17)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)rn at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)rn at com.sun.proxy.$Proxy19.addUser(Unknown Source)rn at com.kaxaka.exam.controller.UserController.addUser(UserController.java:59)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:440)rn at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:428)rn at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)rn at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)rn at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)rn at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)rn at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn at java.lang.Thread.run(Thread.java:662)rnjar包没问题rnsessionfactory是这么配的:rnrn rn rn rn org.hibernate.dialect.MySQLDialectrn truern updatern rn rn rn求大神????rn
hibernate报错:Unknown entity
如果用的是注解,则应确认<em>entity</em>所在的包有没有被扫描到; 如果用的是配置,则应确认<em>entity</em>.hbm.xml有没有被指定
hibernate5 MappingException:Unknown entity问题解决方案
遇到<em>异常</em>:MappingException:Unknown <em>entity</em> 我先在网上搜了一下,中文网站都提到有两种解决方式: 1.注解导错包了,正确的包是:import javax.persistence.Entity; 2.没在hibernate.cfg.xml内配置mapping-> 但是我的问题都不是这两个,到国外的网站查了查,原来是版本问题,我用的是hibernate5
hibernate 报 Unknown entity错误,问题解决方法
程序报错:org.hibernate.MappingException: Unknown <em>entity</em>常见问题(新手需注意) 原因1:import Entity类造成的(使用Eclipse自动提示导入的该包) import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Tra
org.hibernate.MappingException: Unknown entity常见问题(新手需注意)
最近学习Hiberante Annotations时遇到了该问题org.hibernate.MappingException: Unknown <em>entity</em>在baidu和googl上搜寻了 很久也没有找到适合我的解决方法,最后发现是import Entity类造成的(使用Eclipse自动提示导入的该包) import javax.persistence.Id; import java
Hibernate报错org.hibernate.MappingException: Unknown entity解决方法
今天看视频教程学习了一下Hibernate,按照视频教程中的代码写,老师测试通不过,老报错,苦苦找不到原因,最终经过一个下午一个晚上的时间找出了原因,遂记录一下,希望帮助到有需要的人。
Caused by: org.hibernate.MappingException: Unknown entity: com.topwalk.oa.person
唉,这几天总是发帖求救。我算是没救了。。。。rnrn上一个serviceimp为空解决之后。又出现一个问题:如下:望大侠给以指点一二。rnrnHibernate 生成映射文件之后,后续进行数据库插入数据操作。结果报错:rn[color=#FF0000]org.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: com.topwalk.oa.person.asset.bo.AssetsAppBuy; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: com.topwalk.oa.person.asset.bo.AssetsAppBuy[/color]rn at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:690)rn at com.topwalk.oa.person.asset.dao.officeBuyDaoImpl.insert(officeBuyDaoImpl.java:12)rn at com.topwalk.oa.person.asset.service.officeBuyServiceImpl.insert(officeBuyServiceImpl.java:14)rn at com.topwalk.oa.person.asset.action.OfficeBuyAction.start(OfficeBuyAction.java:94)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)rn at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Thread.java:619)rnrnrn[color=#FF00FF]查阅了网上的相关资料如下:rn有人说需要引用@Entity 这个包错了。rn有人说配置cfg的映射文件;rn对此我都做了尝试,对于第一种的方式,对我没效果。但是第二种因为是jbpm工作流结合方式,所以我这是里jbpm.hibernate.cfg.xml 其他同事也有将相关xml文件配置到此处,但是我配置的时候项目直接报404错误,起不来了?rn[/color]rn迷茫了。。。rn请问谁知道是怎么回事哦?rn不胜感激。
spring+hibernate Unknown entity: TabUser 问题
SPRING配置文件rnrnrn rn rn rn rn com.microsoft.jdbc.sqlserver.SQLServerDriverrn rn rn jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=forumrn rn rn sarn rn rn 123rn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.SQLServerDialectrn rn rn rn rn rn edu/fjtu/hibernate/TabUser.hbm.xmlrn rn rn rn rn rn rn rn rnrnrnhibernate配置文件rnrn rn rn rn rn rn rn rn rn rn rn rn rnrnrn
急求助:org.hibernate.MappingException: Unknown entity:
<em>异常</em>错误如:org.hibernate.MappingException: Unknown <em>entity</em>: com.xdtech.platform.domain.model.user.xkqrnrnrn求高手帮忙解决,。。是不是还有什么地方没有配置到哦!!!rn我 的applicationContext.xml配置文件如下rn[code=XML]rnrn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn 1800rn 2rn 0rn 2rn 1800rn 30rn falsernrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn com.xdtech.platform.domain.model.user.Userrn com.xdtech.platform.domain.model.user.UserInfGrouprn com.xdtech.platform.domain.model.user.xkqrn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_REQUIRED,readOnlyrn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_REQUIRED,-Exceptionrn PROPAGATION_SUPPORTSrn rn rn rnrn rn rn rn com.xdtech.platform.web.actions*rn rn rn rn rn transactionInterceptorrn rn rn rnrn rn rn rnrn rnrn rn rn 8011rn rn rn rnrnrn[/code]
Jpa Unknown entity:
今天在做JPa练习时,发现一个错误。很是郁闷,搞了一下午。终于搞定。 java.lang.IllegalArgumentException:Unknown<em>entity</em>:com.<em>entity</em>.TestEntity atorg.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntity...
Hibernate:Unknown entity:
-
org.hibernate.MappingException: Unknown entity: com.pojo.Dept
未知实体。出现这种情况可能有如下原因:1.没有写Mapping映射文件。2.映射文件中的class类名路径写错了,不是实体类的全路径3.没有在hibernate.cfg.xml的&amp;lt;session-factory&amp;gt;中加载映射文件,注意&amp;lt;mapping&amp;gt;节点出现的位置在&amp;lt;property&amp;gt;之后&amp;lt;mapping resource=&quot;com/pojo/Dept.h...
org.hibernate.MappingException: Unknown entity 该怎么解决
org.hibernate.MappingException: Unknown <em>entity</em><em>异常</em>是新手学习hibernate的时候经常遇到的问题。 org.hibernate.MappingException: Unknown <em>entity</em> <em>异常</em>详细信息如下 at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionF
求助:org.hibernate.MappingException: Unknown entity:XXX
出现的<em>异常</em>:rnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: TblQxrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:843)rn at com.<em>entity</em>.TblQxDAO.findById(TblQxDAO.java:51)rn at Test.main(Test.java:44)rnrnrn编写的源代码:rnrnTblQx实体类:rnrnpackage com.<em>entity</em>;rnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.Id;rnrn@Entityrnpublic class TblQx implements java.io.Serializable rn private Integer qxId;rn private String qxName;rnrn public TblQx() rn rnrn @Idrn @GeneratedValuern public Integer getQxId() rn return this.qxId;rn rn rn public void setQxId(Integer qxId) rn this.qxId = qxId;rn rnrn public String getQxName() rn return this.qxName;rn rn rn public void setQxName(String qxName) rn this.qxName = qxName;rn rnrnrnrnmain方法的Test类:rnrnimport com.<em>entity</em>.TblQx;rnimport com.<em>entity</em>.TblQxDAO;rnrnrnpublic class Test rnrn /**rn * @param argsrn */rnrn public static void main(String[] args) rn TblQxDAO qxdao = new TblQxDAO();rn TblQx qx = new TblQx();rnrn qx=qxdao.findById(1);rn System.out.println(qx);rn rnrnrn用的DAO 和HibernateSessionFactory.java 都是MyEclipse自动生成的rnrnhibernate.cfg.xml 的配置:rnrnrnrnrnrnrn rn org.hibernate.dialect.MySQLDialectrn truern jdbc:mysql://localhost:3306/testrn rootrn 1234rn com.mysql.jdbc.Driverrn MySQL5_Testrnrn rn rnrnrnrnrn我使用的是Annotation ,求助各位大侠帮帮忙,查了一个小时的Google、baidu了,还是找不到原因。
Unknown entity:错误,请教高手!!!
是不是我的配置有问题呀?rnName.hbm.xmlrn[code=XML]rnrnrnrn rn rn rn rn rn rn rn rn rn[/code]rnhibernate.cfg.xmlrn[code=XML]rnrnrnrnrnrn rn sarn rn jdbc:microsoft:sqlserver://localhost:1433rn rn rn org.hibernate.dialect.SQLServerDialectrn rn JDBCrn rn com.microsoft.jdbc.sqlserver.SQLServerDriverrn rn rnrn rnrn[/code]
NHibernate.MappingException: Unknown entity class: QuickStart.Cat
<em>异常</em>详细信息: NHibernate.MappingException: Unknown <em>entity</em> class: QuickStart.Catrnrn源错误: rnrnrn行 28: princess.Weight = 7.4f;rn行 29: rn行 30: session.Save(princess);rn行 31: tx.Commit();rnrn文件: c:\inetpub\wwwroot\quickstart\webform1.aspx.cs 行: 30 rnrnrncat.hbm.xml文件:rnrn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnweb.config文件rnrnrn rn rn rn rn rn NHibernate.Dialect.MsSql2000Dialectrn NHibernate.Connection.DriverConnectionProviderrn Server=(local);database=NHibernate;user id=sa;password=sarn NHibernate.Driver.SqlClientDriverrn rn rn rn rnrncat类:rnpublic class Catrn rn private string id;rn private string name;rn private char sex;rn private float weight;rnrn public Cat()rn rnrn rnrn public string Idrn rn get return id; rn set id = value; rn rnrn public string Namern rn get return name; rn set name = value; rn rnrn public char Sexrn rn get return sex; rn set sex = value; rn rnrn public float Weightrn rn get return weight; rn set weight = value; rn rn rnrn请教各位:为什么出现上面如标题所示得问题啊?急.rn rn
MappingException:Unknown entity class:Provider.User
映射<em>异常</em>:未知的实体类:User,为什么呢?rn我做了实体类User,而且给User做了个映射User.hbm.xml了,出这样的错只能是应设文件里面那儿错了,是哪儿呢?
hibernate报错org.hibernate.MappingException: Unknown entity
报错信息如下,我是在Junit里面测试的:rnrnorg.hibernate.MappingException: Unknown <em>entity</em>: com.atguigu.hibernate.helloworld.Newsrn at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)rn at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1447)rn at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)rn at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:177)rn at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)rn at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:678)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:670)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:665)rn at com.atguigu.hibernate.helloworld.HibernateTest.test(HibernateTest.java:32)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)rn at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:309)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnrnhibernate.cfg.xml已经配置如下信息了,News.hbm.xml文件也有rnrnrn这是Junit测试类rnrn[code=java]rnpublic class HibernateTest rnrn @Testrn public void test() rn rn SessionFactory sessionFactory = null;rn Configuration configuration = new Configuration().configure();rn StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder();rn serviceRegistryBuilder.applySettings(configuration.getProperties());rn ServiceRegistry serviceRegistry = serviceRegistryBuilder.build();rn sessionFactory = configuration.buildSessionFactory(serviceRegistry);rn Session session = sessionFactory.openSession();rn org.hibernate.Transaction transaction = session.beginTransaction();rn rn News news = new News("java", "triven", new Date(new java.util.Date().getTime()));rn rn session.save(news);rn rn transaction.commit();rn rn session.close();rn rn sessionFactory.close();rn rnrnrn[/code]
解决org.hibernate.MappingException: Unknown entity: xxx
org.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Integer  解决方法: 问题出现在hibernate的get方法上,http://www.yayihouse.com/yayishuwu/chapter/1501  
单独使用Hibernate时,出现Unknown Entity异常
先上图 工程的文件结构 hibernate.cfg.xml <!DOCTYPE hibernate-configuration
jeecg前台添加数据是出现unknown entity的解决方法
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理<em>异常</em> property mapping has wrong number of columns: com.admin.<em>entity</em>.message.messageEntity; 按照<em>异常</em>提示caused by:我的一方面是注解反回Object失败,便把
hibernate注解报错org.hibernate.MappingException: Unknown entity
使用annotation配置SSH2项目时,遇到这样的错误: org.hibernate.MappingException: Unknown <em>entity</em>: com.jp.bean.TUser   at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)   at or...
一个困扰N天的问题:Unknown entity
-
nhibernate问题(Unknown entity class)
项目用了nhibernaternrn我在数据库里建了张表rn又在项目里建了一个实体类(card_Message.cs),和一个映射文件(card_Message.hbm.xml)rnrn写了个方法rnpublic void Add(Card_Message card_Message)rn rn Card_Message c=Get(card_Message.CardID);rn if(c==null)rn rn session.Save(card_Message);rn rn rnrn运行的时候提示Unknown <em>entity</em> classrnrn请问这是什么原因导致的?
MappingException的Unknown entity class错误
做的是一个联合主键的例子,不知道和这个有关没有。rnnet.sf.hibernate.MappingException: Unknown <em>entity</em> class: wyj.pojo.Tuser2rn at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)rn at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2710)rn at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2717)rn at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:772)rn at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)rn at wyj.CompositeKey.insert(CompositeKey.java:57)rn at wyj.CompositeKey.main(CompositeKey.java:93)rnPOJO和hbm.xml是用MiddleGen和Extension生成的。wyj.pojo.Tuser2是映射的类
[SSH问题]org.hibernate.MappingException: Unknown entity:
<em>异常</em>为:rnrn[color=#FF0000]严重: Servlet.service() for servlet action threw exceptionrnorg.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Long[/color]rnrnrn程序走到action类红色这一行的时候抛了<em>异常</em>: rnpublic ActionForward delete(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn String id = request.getParameter("id"); rn [color=#FF0000]manager.deleteById(id);[/color] rn return list(mapping, form, request, response);rn rn rnrn相关类在这:rnrn[code=Java] public void deleteById(String id) rn Long idl=new Long(id);rn dao.delete(idl);rnrn [/code] rnrn然后dao实现:rn[code=Java] public void delete(Long id) rn rn getHibernateTemplate().delete(id);rnrn [/code]rnrnrn还有POJOrnrn[code=Java]rnprivate Long id;rn public Long getId() rn return id;rn rn public void setId(Long id) rn this.id = id;rn rn[/code]rnrn最后POJO类的映射文件:rn[code=XML]rn rn rn rn [/code]rn[code=XML][/code]rnrn另外,getHibernateTemplate().find和getHibernateTemplate().save 也就是查询和保存方法都可以正常执行rnrn希望大家能帮下忙了,网上找了很多方法都对不上号...
hibernate Unknown entity: com.btg.model.UserInfo 错误
rn[code=XML]rnrnrnrn rn rn rnrn rn rn rn classpath:/com/btg/model/ormrn rn rnrn rn rn org.hibernate.dialect.MySQLInnoDBDialectrn falsern rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn[code=XML]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnrnrn[code=Java]rnpackage com.btg.model;rnrnimport java.util.Date;rnrnpublic class UserInfo extends BaseModel rn private String name;rn private String password;rn private Role role = new Role();rn private Date createDate;rn private Date lastLoginTime;rn private String lastLoginIp;rn private String merchantId;rnrn public String getName() rn return name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn public String getPassword() rn return password;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrn public Role getRole() rn return role;rn rnrn public void setRole(Role role) rn this.role = role;rn rnrn public Date getCreateDate() rn return createDate;rn rnrn public void setCreateDate(Date createDate) rn this.createDate = createDate;rn rnrn public Date getLastLoginTime() rn return lastLoginTime;rn rnrn public void setLastLoginTime(Date lastLoginTime) rn this.lastLoginTime = lastLoginTime;rn rnrn public String getLastLoginIp() rn return lastLoginIp;rn rnrn public void setLastLoginIp(String lastLoginIp) rn this.lastLoginIp = lastLoginIp;rn rnrn public String getMerchantId() rn return merchantId;rn rnrn public void setMerchantId(String merchantId) rn this.merchantId = merchantId;rn rnrnrn[/code]rnrn[code=Java]rnpackage com.btg.dao.hibernate.admin;rnrnimport java.util.Date;rnrnimport java.util.List;rnrnimport com.btg.common.exception.BTGException;rnimport com.btg.dao.UserInfoDao;rnimport com.btg.dao.hibernate.BaseDAOHibernate;rnimport com.btg.model.UserInfo;rnrnpublic class UserInfoDAOHibernate extends BaseDAOHibernate implements UserInfoDao rnrn public void deleteUser(UserInfo user) throws BTGException rn // TODO Auto-generated method stubrn rn rnrn public UserInfo getUser(UserInfo user) throws BTGException rn // TODO Auto-generated method stubrn return null;rn rn rn public List getUserList(UserInfo user) throws BTGException rn user.setId("123456");rn user.setName("12265468");rn user.setLastLoginIp("12424225");rn user.setCreateDate(new Date());rn user.setLastLoginTime(new Date());rn user.setMerchantId("121212");rn user.setPassword("1215421");rn user.getRole().setId("1");rn user.setPassword("1231");rn rn this.getSession().update(user);rn return null;rn rnrnrnrn[/code]rnrn这是我全部相关的类rn错误信息rnWARN [btpool0-1] AbstractExceptionHandler.execute(95) | Unhandled exceptionrnorg.hibernate.MappingException: Unknown <em>entity</em>: com.btg.model.UserInfornrn rnrn我在网上找了好长时间 还是没有搞定 这个是和spring集成在一起,哪个帮忙给我看一下
请教hibernate高手 Unknown entity class: java.lang.Long 异常 在线等
在session.seave(bean);rn的时候报下面<em>异常</em> 请问是怎么回事呀?在线等!谢谢rnnet.sf.hibernate.MappingException: Unknown <em>entity</em> class: java.lang.Longrnrnhbm.xml 如下:rnrnrnrnrn rn rn Represents Userrn @author apollorn rn publicrn rn protectedrn rn rn rn truern rn rn rn truern rn rn rn rn rn rn rn
org.hibernate.MappingException: Unknown entity: java.util.ArrayList错误。
执行删除的时候页面报 org.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: java.util.Ar
Hibernate 中MappingException:Unknown entity的问题解决方案
今天在学Hibernate时, 遇到了MappingException:Unknown <em>entity</em>的<em>异常</em>. 于是上网找解决方案, 找到的方案如下: 一:  import Entity类造成的(使用Eclipse自动提示导入的该包) import org.hibernate.annotations.Entity;//这里出问题 应该改成 import javax.persistenc
org.hibernate.MappingException: Unknown entity:的解决办法
从H3.0过渡到H4.0过程中,有点小痛苦,先搭一个框架搞搞测试类 过程中出现问题,save方法执行的的时候出现问题 org.hibernate.MappingException: Unknown <em>entity</em>: cn.emmos.<em>entity</em>.User at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(Sessi
用maven管理Spring项目出现org.hibernate.MappingException Unknown entity的问题解决办法
由于在做项目有好多包,各个包之间只能单向调用,所以把新添加的功能模块抽取出来,新建了一个包,但是编译通过了,运行的时候,一直报org.hibernate.MappingException Unknown <em>entity</em>的错误
玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert="false" update="fal
最近用JPA遇到这样一个问题:Repeated column in mapping for <em>entity</em>: com.ketayao.security.<em>entity</em>.main.User column: org_id (should be mapped with insert="false" update="false") 这个错误是由实体类引起的,我一开始是这样写的: @Column priv
HIbernate 5 测试连接出现的 Unknown entity异常
<em>异常</em>如下: 测试代码:import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.re
求教异常:org.codehaus.xfire.fault.XFireFault: unknown
以下是全部<em>异常</em>信息,帮帮忙吧 各位大侠rn严重: Servlet.service() for servlet action threw exceptionrnorg.codehaus.xfire.fault.XFireFault: <em>unknown</em>rn at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)rn at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)rn at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)rn at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)rn at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)rn at org.codehaus.xfire.client.Client.onReceive(Client.java:406)rn at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)rn at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)rn at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)rn at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)rn at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)rn at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)rn at org.codehaus.xfire.client.Client.invoke(Client.java:336)rn at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)rn at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)rn at $Proxy195.smsSend(Unknown Source)rn at com.thtf.ezsrs.city.util.telservice.service.spring.CallWS.smsSend(CallWS.java:179)rn at com.thtf.ezsrs.city.util.telservice.web.action.MessAction.doExecute(MessAction.java:48)rn at com.thtf.ezone.ezframework.adapter.struts.ActionUtil.execute(ActionUtil.java:306)rn at com.thtf.ezone.ezframework.adapter.struts.FWAction.execute(FWAction.java:176)rn at com.thtf.ezone.ezframework.adapter.struts.FWRequestProcessor.processActionPerform(FWRequestProcessor.java:70)rn at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)rn at com.thtf.ezone.ezframework.servlet.FrontController.service(FrontController.java:123)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at com.thtf.ezsrs.city.util.permiss.filter.LoginFilter.doFilter(LoginFilter.java:58)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)rn at java.lang.Thread.run(Thread.java:619)rn
spring jpa Unknown entity bean class
错误提示如下:rn[code=Java]rnorg.springframework.dao.InvalidDataAccessApiUsageException: Unknown <em>entity</em> bean class: class cn.edu.jmu.acm.<em>entity</em>.UserInfo, please verify that this class has been marked with the @Entity annotation.; nested exception is java.lang.IllegalArgumentException: Unknown <em>entity</em> bean class: class cn.edu.jmu.acm.<em>entity</em>.UserInfo, please verify that this class has been marked with the @Entity annotation.rn at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:269)rn ...rnorg.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:245)rn ...rnrnCaused by: java.lang.IllegalArgumentException: Unknown <em>entity</em> bean class: class cn.edu.jmu.acm.<em>entity</em>.UserInfo, please verify that this class has been marked with the @Entity annotation.rn ... 35 morern[/code]rnrn出错的实体beanrn[code=Java]rnpackage cn.edu.jmu.acm.<em>entity</em>;rnrnimport java.io.Serializable;rnimport java.util.Date;rnimport java.util.Set;rnimport javax.persistence.Basic;rnimport javax.persistence.CascadeType;rnimport javax.persistence.Column;rnimport javax.persistence.Entity;rnimport javax.persistence.FetchType;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.GenerationType;rnimport javax.persistence.Id;rnimport javax.persistence.JoinColumn;rnimport javax.persistence.ManyToOne;rnimport javax.persistence.NamedQueries;rnimport javax.persistence.NamedQuery;rnimport javax.persistence.OneToMany;rnimport javax.persistence.Table;rnimport javax.persistence.Temporal;rnimport javax.persistence.TemporalType;rnrn/**rn *rn * @author charonrn */rn@Entityrn@Table(name = "UserInfo")rn@NamedQueries(@NamedQuery(name = "UserInfo.findAll", query = "SELECT u FROM UserInfo u"))rnpublic class UserInfo implements Serializable rn private static final long serialVersionUID = 1L;rn @Idrn @GeneratedValue(strategy = GenerationType.IDENTITY)rn @Basic(optional = false)rn @Column(name = "UserInfoId")rn private Integer userInfoId;rn @Basic(optional = false)rn @Column(name = "Account")rn private String account;rn @Basic(optional = false)rn @Column(name = "Email")rn private String email;rn @Column(name = "Nickname")rn private String nickname;rn @Basic(optional = false)rn @Column(name = "Passwd")rn private String passwd;rn @Basic(optional = false)rn @Column(name = "RegistTime")rn @Temporal(TemporalType.TIMESTAMP)rn private Date registTime;rn @Basic(optional = false)rn @Column(name = "SecretAnswer")rn private String secretAnswer;rn @Basic(optional = false)rn @Column(name = "SecretQuestion")rn private String secretQuestion;rn @Basic(optional = false)rn @Column(name = "UserStatus")rn private char userStatus;rn @OneToMany(cascade = CascadeType.ALL, mappedBy = "userInfoId", fetch = FetchType.EAGER)rn private Set contestPlayerCollection;rn @JoinColumn(name = "UserRoleId", referencedColumnName = "UserRoleId")rn @ManyToOne(optional = false, fetch = FetchType.EAGER)rn private UserRole userRoleId;rn @OneToMany(cascade = CascadeType.ALL, mappedBy = "userInfoId", fetch = FetchType.EAGER)rn private Set solutionCollection;rnrn public UserInfo() rn rnrn public UserInfo(Integer userInfoId) rn this.userInfoId = userInfoId;rn rnrn public UserInfo(Integer userInfoId, String account, String email, String passwd, Date registTime, String secretAnswer, String secretQuestion, char userStatus) rn this.userInfoId = userInfoId;rn this.account = account;rn this.email = email;rn this.passwd = passwd;rn this.registTime = registTime;rn this.secretAnswer = secretAnswer;rn this.secretQuestion = secretQuestion;rn this.userStatus = userStatus;rn rnrn /*省略了Setter和Getter方法*/rnrn @Overridern public int hashCode() rn int hash = 0;rn hash += (userInfoId != null ? userInfoId.hashCode() : 0);rn return hash;rn rnrn @Overridern public boolean equals(Object object) rn // TODO: Warning - this method won't work in the case the id fields are not setrn if (!(object instanceof UserInfo)) rn return false;rn rn UserInfo other = (UserInfo) object;rn if ((this.userInfoId == null && other.userInfoId != null) || (this.userInfoId != null && !this.userInfoId.equals(other.userInfoId))) rn return false;rn rn return true;rn rnrn @Overridern public String toString() rn return "cn.edu.jmu.acm.<em>entity</em>.UserInfo[userInfoId=" + userInfoId + "]";rn rnrnrn[/code]rnrnrnspring配置rn[code=XML]rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrn搞了老半天了,看不出哪里出错了,网上有说把rnorg.springframework.instrument.classloading.SimpleLoadTimeWeaverrn替换成rnorg.springframework.instrument.classloading.InstrumentationLoadTimeWeaverrn但替换了还是不行,不知道哪儿错了,麻烦各位帮忙看看
一个困扰N天的问题:Unknown entity
用maven整合ssh2.遇到一个问题。在对实体做持久化时报错:rnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: cn.lvlf.ssh.demo.model.User...rn...rnCaused by: org.hibernate.MappingException: Unknown <em>entity</em>: cn.lvlf.ssh.demo.model.User...rn...rnrn下面将代码贴出来希望能有人指点一下。不胜感谢!rnapplicationContext.xml:rn[code="java"]rn...rn rn rn rn rn rn rn rn $hibernate.dialect rn false rn org.hibernate.cache.EhCacheProvider rn truern rn rn rn rn cn.lvlf.ssh.demo.model.*rn rn rn rn...rn[/code]rnrnUser.javarn[code="java"]rnpackage cn.lvlf.ssh.demo.model;rnrnimport javax.persistence.Column;rnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.GenerationType;rnimport javax.persistence.Id;rnimport javax.persistence.Table;rnrn@Entityrn@Table(name = "t_user")rnpublic class User implements java.io.Serializable rnrn private Long id;rn private String name;rn private String password;rnrn public User() rn rnrn public User(String name, String password) rn this.name = name;rn this.password = password;rn rnrn @Idrn @GeneratedValue(strategy = GenerationType.AUTO)rn @Column(name = "id", unique = true, nullable = false)rn public Long getId() rn return this.id;rn rnrn public void setId(Long id) rn this.id = id;rn rnrn @Column(name = "name")rn public String getName() rn return this.name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn @Column(name = "password")rn public String getPassword() rn return this.password;rn rnrn public void setPassword(String password) rn this.password = password;rn rnrnrn[/code]rnrn数据库(MySql的):rnt_user:rn+----------+--------------+------+-----+---------+----------------+rn| Field | Type | Null | Key | Default | Extra |rn+----------+--------------+------+-----+---------+----------------+rn| id | bigint(20) | NO | PRI | NULL | auto_increment |rn| name | varchar(255) | YES | | NULL | |rn| password | varchar(255) | YES | | NULL | |rn+----------+--------------+------+-----+---------+----------------+rnrn测试代码:rnDaoTest.javarn[code="java"]rnpublic class DaoTest rn rn @Testrn public void testUserDao()rn AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");rn UserDao userDao = (UserDao)ctx.getBean("userDao");rn cn.lvlf.ssh.demo.model.User user = new User("zhangsan","sssss");rn userDao.saveUser(user);rn rn List users = userDao.getAllUsers();rn Assert.assertTrue(users.size()>0);rn rnrn[/code]rnrn
entity: com.h">Exception in thread "main" org.hibernate.MappingException: Unknown entity: com.h
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)rn at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)rn at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)rn at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:70)rn at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)rn at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)rn at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)rn at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)rn at com.hibernate.test.Test.main(Test.java:28)rn
hibernate文件配置出现Repeated column in mapping for entity的Mapping异常处理
今天在配置一对多关系的时候出现了以下<em>异常</em>: org.hibernate.MappingException: Repeated column in mapping for <em>entity</em>com.lrq.<em>entity</em>.Pets column: petsId (should be mapped with insert="false" update="false") 主要原因是mapping
orm.hibernate3.HibernateSystemException: Unknown entity: java.util.ArrayList;
今天遇到这个问题,通过各种百度了解解决,这个错误我是在查找返回list 然后调用删除方法时出现。 解决方案: List list =  hibernateTemplate.find(sb.toString()); for (T t : list) { hibernateTemplate.delete(t); } 因为删除只能用对象,所以一开始我是直接传list进去删除,这
关于Unkown entity的解决方法
原因一般有两个 1.在使用hibernate注解时要导入相应的包需要检查自己是否导入正确的包:javax.persistence.Entity 2.在hibernate的配置文件中是否有对要用的包进行引进。
使用hibernate实体全注解时遇到Unknown entity解决办法
今天在使用hibernate3实体全注解时,
hibernate中报错Unknown entity: org.hibernate.impl.QueryImpl
Exception in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: org.hibernate.impl.QueryImplrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:628)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1366)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:195)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:563)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:551)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)rn at com.yu.sqlTest.test.testQueryCard(test.java:27)rn at com.yu.sqlTest.test.main(test.java:33)rn
Unknown entity: cn.jboa.bean.Email; nested exception is org.hibernate.MappingExc
rn rn public Boolean addEmail(Email email,List l)rn rn rn rn try rn Send send=(Send) this.getHibernateTemplate().load(Send.class, 2);rn Read read=(Read) this.getHibernateTemplate().load(Read.class, 1);rn Garbage garbage=(Garbage) this.getHibernateTemplate().load(Garbage.class, 1);rn Employee employee=(Employee) this.getHibernateTemplate().load(Employee.class, 3);rn rn System.out.println(employee.getNAME()+employee.getEmail());rn email.setREAD_ID(read);rn email.setSEND_ID(send);rn email.setGARBAGE_ID(garbage);rn email.setF_EMPLOYEE_ID(employee);rn email.setS_EMPLOYEE_ID(employee);rn String hql=" from Email e where e.ID=(select max(ID) from Email)";rn this.getHibernateTemplate().save(email);rn rn //addfujian(l,fusele(hql));rn catch (Exception e) rn System.out.println("impEmail新增错误:"+e.getMessage());rn rn return true;rn
做SSH项目出现:org.hibernate.MappingException: Unknown entity:
最近学习SSH出现这个情况,也比较奇怪,我用junit测试的没问题,但提交的表单数据就有问题出现org.hibernate.MappingException: Unknown <em>entity</em>:<em>异常</em>:rn<em>异常</em>信息:rn[code=text]stujiating1 : com.xjgl.server.<em>entity</em>.Stujiatinginfotb@5868d40crnHibernate: select stujiating0_.id as id1_, stujiating0_.sno as sno1_, stujiating0_.jiatingjiegou as jiatingj3_1_, stujiating0_.jiatingfenwei as jiatingf4_1_, stujiating0_.jiatingdizhi as jiatingd5_1_, stujiating0_.jiatingdianhua as jiatingd6_1_, stujiating0_.youbian as youbian1_, stujiating0_.dushengzhinv as dushengz8_1_ from stujiatinginfo stujiating0_ where stujiating0_.sno=?rn2014/11/10 12:48:05[DEBUG][com.xjgl.server.dao.StujiatinginfoDao]:144 -- 添加学生101_1的家庭信息成功rn ==================================================rn student.getStujiatinginfo() : com.xjgl.server.<em>entity</em>.Stujiatinginfotb@1fd7855rn stujiating2.sno : 101_2rn stujiating2.youbian : rnHibernate: insert into student (name, sno, id) values (?, ?, ?)rnHibernate: insert into stujiatinginfo (sno, jiatingjiegou, jiatingfenwei, jiatingdizhi, jiatingdianhua, youbian, dushengzhinv, id) values (?, ?, ?, ?, ?, ?, ?, ?)rnHibernate: select stujiating0_.id as id1_, stujiating0_.sno as sno1_, stujiating0_.jiatingjiegou as jiatingj3_1_, stujiating0_.jiatingfenwei as jiatingf4_1_, stujiating0_.jiatingdizhi as jiatingd5_1_, stujiating0_.jiatingdianhua as jiatingd6_1_, stujiating0_.youbian as youbian1_, stujiating0_.dushengzhinv as dushengz8_1_ from stujiatinginfo stujiating0_ where stujiating0_.sno=?rn2014/11/10 12:48:05[ERROR][org.apache.struts2.dispatcher.Dispatcher]:38 -- Exception occurred during processing request: Unknown <em>entity</em>: com.xjgl.server.<em>entity</em>.Stujiatinginfotb$$EnhancerByCGLIB$$5d40c870rnorg.hibernate.MappingException: Unknown <em>entity</em>: com.xjgl.server.<em>entity</em>.Stujiatinginfotb$$EnhancerByCGLIB$$5d40c870rn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:691)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1485)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:120)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:195)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)rn at com.xjgl.server.dao.StujiatinginfoDao.saveStujiatinginfo(StujiatinginfoDao.java:143)[/code]rn程序代码:rn其中:stujiating1 能保存成功,stujiating2不能保存成功,<em>异常</em>信息就是在保存stujiating2时出现的rn[code=java]Stujiatinginfotb stujiating1 = new Stujiatinginfotb();rn stujiating1.setId(sid + "_1");rn stujiating1.setSno(sno + "_1");rn System.out.println(" stujiating1 : " + stujiating1);rn stujiatinginfoDao.saveStujiatinginfo(stujiating1);rn rn System.out.println(" ==================================================");rn Stujiatinginfotb stujiating2 = new Stujiatinginfotb();rn System.out.println(" student.getStujiatinginfo() : " + student.getStujiatinginfo());rn stujiating2 = student.getStujiatinginfo();rn stujiating2.setId(sid + "_2");rn stujiating2.setSno(sno + "_2");rn System.out.println(" stujiating2.sno : " + stujiating2.getSno());rn System.out.println(" stujiating2.youbian : " + stujiating2.getYoubian());rn stujiatinginfoDao.saveStujiatinginfo(stujiating2);rn log.debug("保存学生家庭信息成功");[/code]rn测试代码:rn[code=java]@Testrn public void testPutStudent() throws MyException rn StudentAll student = new StudentAll();rn Stujiatinginfotb stujiatinginfo = new Stujiatinginfotb();rn student.setStujiatinginfo(stujiatinginfo);rn rn student.setName("zhangsan");rn student.setSno("901");rn rn boolean b = teacherService.putStudent(student);rn rn System.out.println("return : " + b);rn [/code]
初学Hibernate,报Unknown entity: java.lang.String错误
错误如下rnorg.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Stringrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:514)rn at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1302)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:89)rn......rnrnrnMemberRegInfo.hbm.xml文件:rnrn rn rn rn rn rn rn rn rn rn rn rn rnrnrnAction代码rnpublic class MemberRegAction extends Action rnrn public ActionForward execute(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response)rn throws IOException, ServletException rn rn MemberRegForm mrf = (MemberRegForm) form;rn try rn SessionFactory sfy = new Configuration().configure().buildSessionFactory();rn Session session = sfy.openSession();rn rn Transaction tran = session.beginTransaction();rn rn session.save(mrf.getUsername());rn session.save(mrf.getPassword());rn tran.commit();rn session.close();rn sfy.close();rn return mapping.findForward("success");rn catch (Exception e) rn e.printStackTrace();rn return mapping.findForward("defeat");rn rn rn rnrnrn请大家帮帮忙,谢谢!
这个错误org.hibernate.MappingException: Unknown entity: cn.com.sgcc.iss.model.TempAt
我用的注解的方式,为什么还报错。。和配置文件有关系吗?rnrnimport javax.persistence.Entity;rnimport javax.persistence.GeneratedValue;rnimport javax.persistence.GenerationType;rnimport javax.persistence.Id;rnimport javax.persistence.SequenceGenerator;rnimport javax.persistence.Table;rnrn@Entityrn@Table(name="iss_tmp_attackqs_com")rn@SequenceGenerator(name="seq_tmp_attackqs_com",sequenceName="seq_tmp_attackqs_com",allocationSize=1)rnpublic class TempAttackTide rn rn /**rn * @IDrn */rn private int id;rn rn /**rn * @指标一级分类rn */rn private String onetype;rn rn /**rn * @指标二级分类rn */rn private String twotype;rn rn /**rn * @组织机构idrn */rn private int orgId;rn rn /**rn * @指标名称rn */rn private String name;rn rn /**rn * @指标值valuern */rn private String value;rn rn /**rn * @更新时间rn */rn private Date occurTime;rnrn public int getId() rn return id;rn rn @Idrn @GeneratedValue(generator="seq_tmp_attackqs_com",strategy = GenerationType.SEQUENCE)rn public void setId(int id) rn this.id = id;rn rnrn public String getOnetype() rn return onetype;rn rnrn public void setOnetype(String onetype) rn this.onetype = onetype;rn rnrn public String getTwotype() rn return twotype;rn rnrn public void setTwotype(String twotype) rn this.twotype = twotype;rn rnrn public int getOrgId() rn return orgId;rn rnrn public void setOrgId(int orgId) rn this.orgId = orgId;rn rnrn public String getName() rn return name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn public String getValue() rn return value;rn rnrn public void setValue(String value) rn this.value = value;rn rnrn public Date getOccurTime() rn return occurTime;rn rnrn public void setOccurTime(Date occurTime) rn this.occurTime = occurTime;rn
entity"的问题">【web开发】java-spring-hibernate中"Unknown entity"的问题
(1)使用javax.persistence.Entity包,而非import javax.persistence.Entity; (2)在hql中createquery时,一般使用myEntity.class.getName(), 而myEntity.class.getSimpleName()有时会报"Unknown <em>entity</em>";           特别注意session.get()方
nested exception is java.lang.NoSuchMethodError: redis.clients.jedis.JedisShardInfo.setTimeout(I)V
spring-data-redis版本问题 当配置redis集群时发现jedis需要使用高一点的版本,我就把jedis改成了 2.9.0, 发现redis.clients.jedis.JedisShardInfo.setTimeout(I)V错误, 把spring-data-redis的版本改成1.8.9.RELEASE就可以了 ...
【已解决】maven For input string: "8081:8081"
在使用maven 的时候,突然不能编译、打包了 查看maven配置文件发现对应的url写错了 错误示例: [ERROR] For input string: "8081:8081" java.lang.NumberFormatException: For input string: "8081:8081" 解决: 填写正确的url即可 ...
HTTP Status 500 - java.lang.NullPointerException
org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538) org.apache.jasper.servlet.JspServletWrapp
entity">hibernate出错 : main" org.hibernate.MappingException: Unknown entity
hibernate新手,不知道哪里的配置出了错误,望高手指点。rnhibernate.cfg.xml放在src下。rn只有一个包com.wdc,在包里有News.Java 和 NewsManager.javarn代码中News.java利用了注释rn看了以前人们的帖子,将News.hbm.xml配置到了hibernate.cfg.xml中,还是不对。rn错误代码:rn[code=text]INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetExceptionrn十一月 30, 2015 4:08:23 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate executernINFO: HHH000228: Running hbm2ddl schema updaternException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: com.wdc.Newsrn at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)rn at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1462)rn at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)rn at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:177)rn at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)rn at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:678)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:670)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:665)rn at com.wdc.NewsManager.main(NewsManager.java:33)[/code]rnrnhibernate.cfg.xmlrn[code=text]rnrnrnrn rn rn com.mysql.jdbc.Driverrn rn jdbc:mysql://localhost/javaeern rn rootrn rn rootrn rn 20rn rn 1rn rn 5000rn rn 100rn 3000rn 2rn truern rn org.hibernate.dialect.MySQL5InnoDBDialectrn rn updatern rn truern rn truern rn rn rnrn[/code]rnrnNews.javarn[code=java]rnpackage com.wdc;rnimport javax.persistence.*;rnrn@Entityrn@Table(name="news_inf")rnpublic class Newsrnrn // 消息类的标识属性rn @Idrn @GeneratedValue(strategy=GenerationType.IDENTITY)rn private Integer id;rn // 消息标题rn private String title;rn // 消息内容rn private String content;rnrn // id的setter和getter方法rn public void setId(Integer id)rn rn this.id = id;rn rn public Integer getId()rn rn return this.id;rn rn // title的setter和getter方法rn public void setTitle(String title)rn rn this.title = title;rn rn public String getTitle()rn rn return this.title;rn rn // content的setter和getter方法rn public void setContent(String content)rn rn this.content = content;rn rn public String getContent()rn rn return this.content;rn rnrn[/code]rnNewsManager.javarn[code=java]rnpackage com.wdc;rnimport org.hibernate.*;rnimport org.hibernate.cfg.*;rnimport org.hibernate.service.*;rnimport org.hibernate.boot.registry.*;rnpublic class NewsManagerrnrn public static void main(String[] args)rn throws Exceptionrn rn // 实例化Configuration,rn Configuration conf = new Configuration().configure();rnrn ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()rn .applySettings(conf.getProperties()).build();rn // 以Configuration实例创建SessionFactory实例rn SessionFactory sf = conf.buildSessionFactory(serviceRegistry);rn // 创建Sessionrn Session sess = sf.openSession();rn // 开始事务rn Transaction tx = sess.beginTransaction();rn // 创建消息对象rn News n = new News();rn // 设置消息标题和消息内容rn n.setTitle("123");rn n.setContent("abc");rn // 保存消息rn sess.save(n);rn // 提交事务rn tx.commit();rn // 关闭Sessionrn sess.close();rn sf.close();rn rnrn[/code]
entity)">请教(Exception in thread "main" org.hibernate.MappingException: Unknown entity)
[color=#FF0000]请教错误原因?[/color]rn[code=Java]rnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: sys.model.Userrn at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)rn at sys.dao.impl.HibernateDao.get(HibernateDao.java:40)rn at sys.dao.impl.HibernateDao.get(HibernateDao.java:48)rn at sys.dao.impl.HibernateDao$$FastClassByCGLIB$$abf5ef51.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)rn at sys.dao.impl.UserDaoImpl$$EnhancerByCGLIB$$6951f724.get()rn at sys.service.impl.UserServiceImpl.getUser(UserServiceImpl.java:47)rn at sys.service.impl.UserServiceImpl$$FastClassByCGLIB$$9ff87ad6.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)rn at sys.service.impl.UserServiceImpl$$EnhancerByCGLIB$$8317f35e.getUser()rn at test.Test.main(Test.java:24)rn[/code]rnrnrn applicationContext.xm配置文件rn[code=Java]rnrnrnrn rn rn rn rn rn classpath:jdbc.propertiesrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rnrn rn rn rn rn rn $hibernate.dialectrn $hibernate.show_sqlrn rn rn rn rnrn rn rn rn rnrn rn rnrn rn rn rn rnrn rn rn rn rn rn rn rn rn rnrn[/code]rnrn测试类代码rn[code=Java]rnpackage test;rnrnimport org.springframework.context.ApplicationContext;rnimport org.springframework.context.support.ClassPathXmlApplicationContext;rnrnimport sys.model.Role;rnimport sys.model.User;rnimport sys.service.RoleService;rnimport sys.service.UserService;rnrnrnrn/**rn * rn * @author rn * @version 1.0rn */rnpublic class Test rnrn public static void main(String[] args) rn ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");rn UserService userManager = (UserService)context.getBean("userService");rn RoleService roleManager = (RoleService)context.getBean("roleService");rn User user = userManager.getUser(1);rn System.out.println("ID"+user.getId()+" 111"+user.getName());rn Role role = roleManager.getRole(1);rn System.out.println("ID"+role.getId()+" 222 "+role.getName());rn rnrnrn[/code]rnrn目录结构rnrn[img=C:\code.png][/img]
(请教SSH框架中)org.hibernate.MappingException: Unknown entity
报错:rnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: cqu.edu.<em>entity</em>.Studentsrn at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)rn at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1451)rn at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:100)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)rn at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.<em>entity</em>IsTransient(DefaultSaveOrUpdateEventListener.java:177)rn at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)rn at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)rn at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:678)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:670)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:665)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338)rn at com.sun.proxy.$Proxy19.save(Unknown Source)rn at cqu.edu.<em>entity</em>.TestStudents.testSaveStudent(TestStudents.java:48)rn at cqu.edu.<em>entity</em>.TestStudents.main(TestStudents.java:58)rnStudents.hbm.xml文件:rnrnrnrn rn rn rn rn rn rn rn rn rn rn rnhibernate.cfg.xml配置文件:rnrn rn rn rn rootrn 123456rn com.mysql.jdbc.Driver rn jdbc:mysql://127.0.0.1:3306/students_database?useUnicode=true&characterEncoding=UTF-8 rn org.hibernate.dialect.MySQLDialect rn true rn true rn update rn rn thread rn none rn rn rn rn rn rn rn测试类:rn@Testrn public void testSaveStudent()rn Configuration cfg = new Configuration();rn cfg.configure();rn Session session = MyHibernateSessionFactory.getSessionFactory().getCurrentSession();rn session.beginTransaction();rn Transaction tx=session.beginTransaction();rn rn // cfg.addClass(cqu.edu.<em>entity</em>.Students.class); rn rn Students student1=new Students("S0000001","张三","男",new Date(),"重庆");rn Students student2=new Students("S0000002","李四","男",new Date(),"海南");rn Students student3=new Students("S0000003","王五","男",new Date(),"四川"); rn session.save(student1);rn session.save(student2);rn session.save(student3);rnrn tx.commit();rn rn我明明已经配置了mapping为什么还说找不到我的实体类??麻烦大家帮我看看,谢谢
hibernate添加新的功能模块报错 unknown entity
使用hibernate进行开发时,有时会碰到   org.hibernate.MappingException: Unknown <em>entity</em>   获取数据列表时也是一直为空无法识别,很有可能是 项目中的 hibernate配置文件 sessionFactory的packagesToScan属性的新地址没有加入或者位置配置不对 例如一般实体类位置为  com.aaa.web.bbb.en
SPA项目开发 之 登录注册
SPA项目开发之登录注册登录注册的大体流程前端后端 登录注册的大体流程 1. vue怎么引入和配置使用element-ui框架 1.1 使用vue-cli脚手架工具创建一个vue项目 vue init webpack pro01 1.2 npm安装elementUI cd pro01 #进入新建项目的根目录 npm install...
Socket UDPClient下载
用C# Socket 实现UDPClient功能 相关下载链接:[url=//download.csdn.net/download/courageously/4840971?utm_source=bbsseo]//download.csdn.net/download/courageously/4840971?utm_source=bbsseo[/url]
单片机的功能模块下载
单片机的功能模块,I/O口设置和功能,以及各种定时器、计数器的工作方式教学 相关下载链接:[url=//download.csdn.net/download/u010528592/5320401?utm_source=bbsseo]//download.csdn.net/download/u010528592/5320401?utm_source=bbsseo[/url]
电脑清理的知识下载
电脑清理,教你如何去清理电脑中的垃圾,但是不怎么专业 相关下载链接:[url=//download.csdn.net/download/ww2890/7824477?utm_source=bbsseo]//download.csdn.net/download/ww2890/7824477?utm_source=bbsseo[/url]
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件
我们是很有底线的