org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: Use [问题点数:20分,结帖人simonjenkin]

Bbs1
本版专家分:0
结帖率 100%
Bbs1
本版专家分:0
Bbs1
本版专家分:0
Bbs5
本版专家分:2457
Bbs1
本版专家分:0
Bbs5
本版专家分:2457
Bbs1
本版专家分:0
Bbs2
本版专家分:141
Bbs1
本版专家分:0
Bbs2
本版专家分:141
Bbs3
本版专家分:598
Bbs1
本版专家分:0
Bbs1
本版专家分:0
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
org.springframework.orm.hibernate3.HibernateSystemException
用SSH框架写更新操作的时候出现错误,求各位大神解决rnorg.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.remotediagnose.model.Patient#3]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.remotediagnose.model.Patient#3]rn at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)rn at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:705)rn at org.springframework.orm.hibernate3.HibernateTemplate.update(HibernateTemplate.java:701)rn at com.remotediagnose.dao.impl.PatientDaoImpl.modifyPatientInfor(PatientDaoImpl.java:80)rn at com.remotediagnose.service.impl.PatientServiceImpl.modifyPInfor(PatientServiceImpl.java:55)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:309)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.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.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)rn at $Proxy17.modifyPInfor(Unknown Source)rn at com.remotediagnose.action.PatientAction.modifypInfo(PatientAction.java:80)rn at com.action.PatientActionTest.testmodifypInfo(PatientActionTest.java:68)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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)rn at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)rn at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)rn at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:236)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)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)rnCa<em>use</em>d by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.remotediagnose.model.Patient#3]rn at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:638)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:305)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.<em>entity</em>IsDetached(DefaultSaveOrUpdateEventListener.java:246)rn at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:57)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)rn at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:742)rn at org.hibernate.impl.SessionImpl.update(SessionImpl.java:730)rn at org.hibernate.impl.SessionImpl.update(SessionImpl.java:722)rn at org.springframework.orm.hibernate3.HibernateTemplate$14.doInHibernate(HibernateTemplate.java:708)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)rn ... 48 morernrn
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:
异常错误如:org.hibernate.MappingException: Unknown <em>entity</em>: com.xdtech.platform.domain.model.<em>use</em>r.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.<em>use</em>r.Userrn com.xdtech.platform.domain.model.<em>use</em>r.UserInfGrouprn com.xdtech.platform.domain.model.<em>use</em>r.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]
求助:org.hibernate.MappingException: Unknown entity:XXX
出现的异常: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
整了老久了都没有发现是哪的问题:我是新手,麻烦高手指点一下rnrn下面是错误代码:rn具体的代码如下:rn[code=Java]org.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: com.oa.model.Organization$$EnhancerByCGLIB$$40141085; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: com.oa.model.Organization$$EnhancerByCGLIB$$40141085rn org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)rn org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:694)rn com.oa.dao.imp.OrgDaoImp.addOrg(OrgDaoImp.java:15)rnrnrn[/code]rnrnOrganization.hbm.xmlrnrn[code=Java]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn[/code]rnaction 代码:rnrnrn[code=Java]package com.oa.web;rnrnimport javax.annotation.Resource;rnrnimport com.oa.model.Organization;rnimport com.oa.service.OrgService;rnrnpublic class OrgAction rn @Resource OrgService orgService;rn private Organization organization;rn public Organization getOrganization() rn return organization;rn rn public void setOrganization(Organization organization) rn this.organization = organization;rn rn public void add()rn rn rn this.orgService.addOrg(this.organization,0);rn rnrn[/code]rnrnapplication代码:rnrn[code=Java]rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn classpath:/com/oa/vorn rn rn rn rn rn hibernate.dialect=org.hibernate.dialect.SQLServerDialectrn hibernate.hbm2ddl.auto=updatarn hibernate.show_sql=truern hibernate.format_sql=truern rn rn rnrnrn rn rn rnrn[/code]rn rn现在是能得到页面的数据,但是添加时出现上述错误,望高手解答:rn还有就是,如果是new一个实体类进行添加时,是没有问题的....
org.hibernate.MappingException: Unknown entity: java.util.ArrayList错误。
执行删除的时候页面报rnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: java.util.ArrayListrnrn异常。我的HQL语句如下;rn[code=Java]public void cancelYuyue(Long id) rn rn getHibernateTemplate().deleternrn(getHibernateTemplate().find("from OrderInstrumentReservation where id="+id+"and status='待审核'"));rn //getHibernateTemplate().find("from OrderInstrumentReservation where adminId="+id+"and status='待审核'");rn rn rn[/code]rnrn我想做的是:根据用户id 查找,删除 用户status =‘待审核的’ OrderInstrumentReservation对象记录。rnrn执行后后台输出执行SQL语句如下:rn[code=Java]Hibernate: select orderinstr0_.id as id1_, orderinstr0_.instrumentId as instrume2_1_, orderinstr0_.adminId as adminId1_, orderinstr0_.<em>use</em>rId as <em>use</em>rId1_, orderinstr0_.name as name1_, orderinstr0_.unit as unit1_, orderinstr0_.startTime as startTime1_, rnrnorderinstr0_.endTime as endTime1_, orderinstr0_.applyTime as applyTime1_, orderinstr0_.actualStartTime as actualS10_1_, orderinstr0_.actualEndTime as actualE11_1_, orderinstr0_.actualCost as actualCost1_, rnrnorderinstr0_.status as status1_, orderinstr0_.<em>use</em>Number as <em>use</em>Number1_, orderinstr0_.actualUseNumber as actualU15_1_, orderinstr0_.remark as remark1_, orderinstr0_.sysTime as sysTime1_, orderinstr0_.timeA as timeA1_, orderinstr0_.timeB as timeB1_, orderinstr0_.timeC as timeC1_, orderinstr0_.timeD as timeD1_, orderinstr0_.timeE as timeE1_, orderinstr0_.timeF as timeF1_, rnrnorderinstr0_.timeG as timeG1_, orderinstr0_.timeH as timeH1_, orderinstr0_.timeI as timeI1_, orderinstr0_.timeJ as timeJ1_, orderinstr0_.timeK as timeK1_, orderinstr0_.timeL as timeL1_, orderinstr0_.timeM as timeM1_, orderinstr0_.timeN as timeN1_ from rnrnorderSys.dbo.order_instrumentReservation orderinstr0_ where orderinstr0_.id=53 and orderinstr0_.status='待审核'rn[/code]rn
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
异常详细信息: 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;<em>use</em>r 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
映射异常:未知的实体类: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]
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.T<em>use</em>r2rn 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.T<em>use</em>r2是映射的类
Caused by: org.hibernate.MappingException: Unknown entity:异常
ssh框架做的项目中,DAO文件等都是用hibernate自动生成的。rn当我点击页面上的添加按钮时:却出现了这个异常;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)rnCa<em>use</em>d 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/
[SSH问题]org.hibernate.MappingException: Unknown entity:
异常为:rnrn[color=#FF0000]严重: Servlet.service() for servlet action threw exceptionrnorg.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Long[/color]rnrnrn程序走到action类红色这一行的时候抛了异常: 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 <em>use</em>r) throws BTGException rn // TODO Auto-generated method stubrn rn rnrn public UserInfo getUser(UserInfo <em>use</em>r) throws BTGException rn // TODO Auto-generated method stubrn return null;rn rn rn public List getUserList(UserInfo <em>use</em>r) throws BTGException rn <em>use</em>r.setId("123456");rn <em>use</em>r.setName("12265468");rn <em>use</em>r.setLastLoginIp("12424225");rn <em>use</em>r.setCreateDate(new Date());rn <em>use</em>r.setLastLoginTime(new Date());rn <em>use</em>r.setMerchantId("121212");rn <em>use</em>r.setPassword("1215421");rn <em>use</em>r.getRole().setId("1");rn <em>use</em>r.setPassword("1231");rn rn this.getSession().update(<em>use</em>r);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集成在一起,哪个帮忙给我看一下
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentExce
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred calling getter of com.cn.model.Groupwater.grid; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.cn.model.Groupwater.gridrn org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)rn org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339)rn com.cn.dao.hibernate.EntityDaoImpl.findCountsByCriteria(EntityDaoImpl.java:209)rn com.cn.service.impl.LoginManagerImpl.findAllRow(LoginManagerImpl.java:86)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtilsrnrn多对一 查询报的错sql语句都打印出来了rnHibernate: select this_.emp_id as emp1_6_0_, this_.emp_name as emp2_6_0_, this_.emp_mobile as emp3_6_0_, this_.emp_zw as emp4_6_0_, this_.gr_id as gr5_6_0_ from study.sys_emp this_ where this_.gr_id=?rnrnrnrnrnrnrnrnrn rn rn rn rn rn rnrn rn rn rn rn rn rn rnrnrnrnrnrnrnrnrn rn rn rn rn rn rnrn rnrn rn rn rn rn rn rn rn rnrnrnrn这个实现DAOrnpublic int findCountsByCriteria(final Class <em>entity</em>Class,final Criterion... criterions)rn int totalCounts = (Integer)getHibernateTemplate().execute(new HibernateCallback()rnrn public Object doInHibernate(Session session)rn throws HibernateException, SQLException rn Criteria criteria = session.createCriteria(<em>entity</em>Class);rn rn System.out.println("shit");//这里打印了rn for(Criterion criterion : criterions)rn System.out.println(criterion);//这里也打印了rn criteria.add(criterion);rn rn rn //这后面就没有执行rn int totalCounts = criteria.list().size();rn return totalCounts;rn rn );rn return totalCounts;rn rnrn
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 ...rnrnCa<em>use</em>d 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 <em>use</em>rInfoId;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 <em>use</em>rStatus;rn @OneToMany(cascade = CascadeType.ALL, mappedBy = "<em>use</em>rInfoId", fetch = FetchType.EAGER)rn private Set contestPlayerCollection;rn @JoinColumn(name = "UserRoleId", referencedColumnName = "UserRoleId")rn @ManyToOne(optional = false, fetch = FetchType.EAGER)rn private UserRole <em>use</em>rRoleId;rn @OneToMany(cascade = CascadeType.ALL, mappedBy = "<em>use</em>rInfoId", fetch = FetchType.EAGER)rn private Set solutionCollection;rnrn public UserInfo() rn rnrn public UserInfo(Integer <em>use</em>rInfoId) rn this.<em>use</em>rInfoId = <em>use</em>rInfoId;rn rnrn public UserInfo(Integer <em>use</em>rInfoId, String account, String email, String passwd, Date registTime, String secretAnswer, String secretQuestion, char <em>use</em>rStatus) rn this.<em>use</em>rInfoId = <em>use</em>rInfoId;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.<em>use</em>rStatus = <em>use</em>rStatus;rn rnrn /*省略了Setter和Getter方法*/rnrn @Overridern public int hashCode() rn int hash = 0;rn hash += (<em>use</em>rInfoId != null ? <em>use</em>rInfoId.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.<em>use</em>rInfoId == null && other.<em>use</em>rInfoId != null) || (this.<em>use</em>rInfoId != null && !this.<em>use</em>rInfoId.equals(other.<em>use</em>rInfoId))) rn return false;rn rn return true;rn rnrn @Overridern public String toString() rn return "cn.edu.jmu.acm.<em>entity</em>.UserInfo[<em>use</em>rInfoId=" + <em>use</em>rInfoId + "]";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...rnCa<em>use</em>d 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_<em>use</em>r")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_<em>use</em>r: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 <em>use</em>rDao = (UserDao)ctx.getBean("<em>use</em>rDao");rn cn.lvlf.ssh.demo.model.User <em>use</em>r = new User("zhangsan","sssss");rn <em>use</em>rDao.saveUser(<em>use</em>r);rn rn List <em>use</em>rs = <em>use</em>rDao.getAllUsers();rn Assert.assertTrue(<em>use</em>rs.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中报错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,f<em>use</em>le(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>:异常:rn异常信息: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不能保存成功,异常信息就是在保存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">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]
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
新人求助,hibernate的Unknown entity问题
[code=java]rnpackage com.atsp.hibernate.helloworld;rnrnimport java.sql.Date;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.Transaction;rnimport org.hibernate.boot.registry.StandardServiceRegistry;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnimport org.hibernate.cfg.Configuration;rnimport org.junit.Test;rnrnrnpublic class HibernateTest rnrn @Testrn public void test() rn System.out.println("test....");rn //创建回话工厂对象rn SessionFactory sessionFactory = null;rn //创建配置对象rn Configuration configuration = new Configuration().configure();rn rn //创建StandardServiceRegistry 对象,最新的hibernate使用 的方法rn //hibernate的任何配置和服务都需要在该对象中注册后才能实现rnrn StandardServiceRegistryBuilder standardServiceRegistryBuilder = rn new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());rn StandardServiceRegistry standardServiceRegistry = standardServiceRegistryBuilder.build();rn sessionFactory = configuration.buildSessionFactory(standardServiceRegistry);rn Session session = sessionFactory.openSession();rn Transaction transaction = session.beginTransaction();rn News news = new News("java","ATSP",new Date(new java.util.Date().getTime()));rn System.out.println(news);rn session.save(news);rn transaction.commit();rn session.close();rn sessionFactory.close();rn rnrnrn上面是测试类rn[/code]rnrnrn[code=java]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrn[/code]rn以上是News.hbm.xml配置文件rnrn[code=java]rnrnrnrn rn rn rootrn 123rn com.mysql.jdbc.Driverrn jdbc:mysql:///bookstorern rn rn rn org.hibernate.dialect.MySQLInnoDBDialectrnrn rn truern rn truern rn rn updaternrn rn rn rn rnrn[/code]rn以上是hibernate.cfg.xmlrn[code=java]rnpackage com.atsp.hibernate.helloworld;rnrnimport java.sql.Date;rnrnpublic class News rn private Integer id;rn private String title;rn private String author;rn rn private Date date;rn[/code]rnnews基本类rn运行测试类报Unknown <em>entity</em>: com.atsp.hibernate.helloword.News,实在不知道哪里错了,求大神指点。
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 <em>use</em>rManager = (UserService)context.getBean("<em>use</em>rService");rn RoleService roleManager = (RoleService)context.getBean("roleService");rn User <em>use</em>r = <em>use</em>rManager.getUser(1);rn System.out.println("ID"+<em>use</em>r.getId()+" 111"+<em>use</em>r.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?<em>use</em>Unicode=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
Spring和Hibernate结合出现Unknown entity: java.lang.String
第一次发帖,如果有什么规矩不知道,请大家包含。这是我用spring和hibernate整合时出现的错误,上网找了很多,有说数据库表错误的,有说主键类型不是int的,但是我实在解决不了,所以来此求助,请大家指点,十分感谢[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/42.gif][/img]rn[color=#FF0000]这是我的Student类的映射文件Student.hbm.xml。Student里有两个字段:id (int类型)和name (String类型)。[/color]rn[img=https://img-bbs.csdn.net/upload/201406/06/1402050244_876223.jpg][/img]rn[color=#FF0000]我定义的bean。想法是把SessionFactory注入oracleImpl再注入studentService。用Service层调用oracle的dao实现,完成Student实体类的添加。[/color]rn[img=https://img-bbs.csdn.net/upload/201406/06/1402050674_867426.jpg][/img]rn[color=#FF0000]这是我dao层连接oracle数据库的实现oracleImpl。[/color]rn[img=https://img-bbs.csdn.net/upload/201406/06/1402051017_268567.jpg][/img]rn[color=#FF0000]但是用JUint测试的时候,出现错误:[/color]rn[img=https://img-bbs.csdn.net/upload/201406/06/1402051158_121240.jpg][/img]rn[color=#FF0000]我的数据库表[/color]rn[img=https://img-bbs.csdn.net/upload/201406/06/1402051463_629201.jpg][/img]
求助关于NHibernate错误-----Unknown entity class
Unknown <em>entity</em> class: NhibernateSample1.Personrnrn用过的大侠请你指点一二吧.为啥在:rnISessionFactory Factory = cfg.BuildSessionFactory();rnrnrn ISession session = Factory.OpenSession();rn ITransaction trans = session.BeginTransaction();rn session.Save(ps);//这一步就报错rn
很怪的问题org.hibernate.MappingException: Unknown entity,求解
我写了POJO后,配置了注解,确认了导入的是javax.persistence.Entity,rn启动tomcat之后,rn252 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GArn351 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding <em>entity</em> from annotated class: com.zhijian.domain.Bookrn418 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind <em>entity</em> com.zhijian.domain.Book on table book_inforn结束,rn然后dao通过Criteria读取数据是报rnorg.hibernate.MappingException: Unknown <em>entity</em>: from Bookrn以下是图书的POJO对象rnimport java.io.Serializable;rnimport java.util.ArrayList;rnimport java.util.Date;rnimport java.util.List;rnimport javax.persistence.*;rnimport org.apache.commons.lang.builder.ToStringBuilder;rnrn@Entityrn@Table(name="book_info")rnpublic class Book implements Serializablern @Idrn @GeneratedValuern private int id;//书的idrn private String name;//书名rn private String kind;//书的类型rn private String barCode;//书的ISBNrn private String press;//书的出版社rn private String auther;//书的作者rn private String price;//书的价格rn private String vipPrice;//书的VIP价格rn private Date pressDate;//书的发行日期rn private int mount;//书的数量rn private String location;//书所在的书架的位置rn private Date createDate;//图书的创建日期rn @ManyToMany(mappedBy = "books")rn private List bookTops = new ArrayList();rngetter and setter省略rn
日了dog了,SSH报Unknown entity
错误信息:rnorg.hibernate.MappingException: Unknown <em>entity</em>: com.snow.naoke.domain.Userrn 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.snow.naoke.test.TestService.saveTwoUsers(TestService.java:21)rn at com.snow.naoke.test.TestService$$FastClassByCGLIB$$ef96b79d.invoke()rn at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)rn at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)rn at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)rn at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)rn at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)rn at com.snow.naoke.test.TestService$$EnhancerByCGLIB$$f9b34052.saveTwoUsers()rn at com.snow.naoke.test.SpringTest.testTransaction(SpringTest.java:23)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)rn at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)rn at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)rn at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)rn at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)rn at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)rn at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)rn at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)rn at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)rn at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)rn at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)rn at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)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)rnrnrnUser.hbm.xmlrn[code=java]rnrnrn rn rn rn rn rn rn rnrn[/code]rnrnhibernate.cfg.xmlrn[code=java]rnrnrnrn rn org.hibernate.dialect.MySQL5Dialectrn rnrn rn truern updaternrn rn rnrnrnrnrn[/code]rnrnapplicationContext.xmlrn[code=java]rn rn rnrnrn rn rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rnrnrn rn rn rn rn rn[/code]
Hibernate5 提示:org.hibernate.MappingException: Unknown entity: entity.Users
下载了最新的Hibernate5 jar文件,测试就出错了。如何修改呢?rn提示:org.hibernate.MappingException: Unknown <em>entity</em>: <em>entity</em>.Usersrnrn使用Myeclipse 2014rnrn数据库 Sql server 2008rnrnjava sdk 1.7rnrntopcat 7rn 数据库名 testdatabase,有一个表Usersrnrn这个是 Users.java 2014反向自动生成的rnpackage <em>entity</em>;rnrn/**rn * Users <em>entity</em>. @author MyEclipse Persistence Toolsrn */rnrnpublic class Users implements java.io.Serializable rnrn // Fieldsrnrn private UsersId id;rnrn // Constructorsrnrn /** default constructor */rn public Users() rn rnrn /** full constructor */rn public Users(UsersId id) rn this.id = id;rn rnrn // Property accessorsrnrn public UsersId getId() rn return this.id;rn rnrn public void setId(UsersId id) rn this.id = id;rn rnrnrnrnjsp测试代码:public class Test rn rn public Test()rn rn System.out.println("this is a test ");rn rn rn public void addUser()rn rn Users <em>use</em>r=new Users();rn rn rn Session session=HibernateSessionFactory.getSession();rn Transaction tx=null;rn tryrn rn tx=session.beginTransaction();rn session.save(<em>use</em>r);rn tx.commit();rn rn catch (Exception e)rn rn if (tx!=null)rn tx.rollback();rn e.printStackTrace();rn finallyrn HibernateSessionFactory.closeSession();rn rn rn rnrnrn///Usersid.java 2014反向自动生成的rnpublic class UsersId implements java.io.Serializable rnrn // Fieldsrnrn private Integer id;rn private String loginname;rn private String loginpwd;rn private String name;rn private String address;rn private String phone;rn private String mail;rn private Timestamp birthday;rnrn // Constructorsrnrn /** default constructor */rn public UsersId() rn rnrn /** minimal constructor */rn public UsersId(Integer id) rn this.id = id;rn rnrn /** full constructor */rn public UsersId(Integer id, String loginname, String loginpwd, String name,rn String address, String phone, String mail, Timestamp birthday) rn this.id = id;rn this.loginname = loginname;rn this.loginpwd = loginpwd;rn this.name = name;rn this.address = address;rn this.phone = phone;rn this.mail = mail;rn this.birthday = birthday;rn rnrn // Property accessorsrnrn public Integer getId() rn return this.id;rn rnrn public void setId(Integer id) rn this.id = id;rn rnrn public String getLoginname() rn return this.loginname;rn rnrn public void setLoginname(String loginname) rn this.loginname = loginname;rn rnrn public String getLoginpwd() rn return this.loginpwd;rn rnrn public void setLoginpwd(String loginpwd) rn this.loginpwd = loginpwd;rn rnrn public String getName() rn return this.name;rn rnrn public void setName(String name) rn this.name = name;rn rnrn public String getAddress() rn return this.address;rn rnrn public void setAddress(String address) rn this.address = address;rn rnrn public String getPhone() rn return this.phone;rn rnrn public void setPhone(String phone) rn this.phone = phone;rn rnrn public String getMail() rn return this.mail;rn rnrn public void setMail(String mail) rn this.mail = mail;rn rnrn public Timestamp getBirthday() rn return this.birthday;rn rnrn public void setBirthday(Timestamp birthday) rn this.birthday = birthday;rn rnrn public boolean equals(Object other) rn if ((this == other))rn return true;rn if ((other == null))rn return false;rn if (!(other instanceof UsersId))rn return false;rn UsersId castOther = (UsersId) other;rnrn return ((this.getId() == castOther.getId()) || (this.getId() != nullrn && castOther.getId() != null && this.getId().equals(rn castOther.getId())))rn && ((this.getLoginname() == castOther.getLoginname()) || (thisrn .getLoginname() != nullrn && castOther.getLoginname() != null && thisrn .getLoginname().equals(castOther.getLoginname())))rn && ((this.getLoginpwd() == castOther.getLoginpwd()) || (thisrn .getLoginpwd() != nullrn && castOther.getLoginpwd() != null && thisrn .getLoginpwd().equals(castOther.getLoginpwd())))rn && ((this.getName() == castOther.getName()) || (this.getName() != nullrn && castOther.getName() != null && this.getName()rn .equals(castOther.getName())))rn && ((this.getAddress() == castOther.getAddress()) || (thisrn .getAddress() != null && castOther.getAddress() != null && thisrn .getAddress().equals(castOther.getAddress())))rn && ((this.getPhone() == castOther.getPhone()) || (thisrn .getPhone() != null && castOther.getPhone() != null && thisrn .getPhone().equals(castOther.getPhone())))rn && ((this.getMail() == castOther.getMail()) || (this.getMail() != nullrn && castOther.getMail() != null && this.getMail()rn .equals(castOther.getMail())))rn && ((this.getBirthday() == castOther.getBirthday()) || (thisrn .getBirthday() != nullrn && castOther.getBirthday() != null && thisrn .getBirthday().equals(castOther.getBirthday())));rn rnrn public int hashCode() rn int result = 17;rnrn result = 37 * result + (getId() == null ? 0 : this.getId().hashCode());rn result = 37 * resultrn + (getLoginname() == null ? 0 : this.getLoginname().hashCode());rn result = 37 * resultrn + (getLoginpwd() == null ? 0 : this.getLoginpwd().hashCode());rn result = 37 * resultrn + (getName() == null ? 0 : this.getName().hashCode());rn result = 37 * resultrn + (getAddress() == null ? 0 : this.getAddress().hashCode());rn result = 37 * resultrn + (getPhone() == null ? 0 : this.getPhone().hashCode());rn result = 37 * resultrn + (getMail() == null ? 0 : this.getMail().hashCode());rn result = 37 * resultrn + (getBirthday() == null ? 0 : this.getBirthday().hashCode());rn return result;rn rnrnrnrn映射文件Users.hbm.xmlrnrn 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 rnrnrn配置文件rnrnrn rn updatern rn org.hibernate.dialect.SQLServerDialectrn rn rn jdbc:sqlserver://localhost:1433;databaseName=testdatabasern rn sarn xxxxxrn rn com.microsoft.sqlserver.jdbc.SQLServerDriverrn rn myconnrn rnrn rnrn
hibernate总是提示 org.hibernate.MappingException: Unknown entity
我用的hibernate5.2来做最简单的hibernate操作,就是调用hibernate的save()到数据库中存入一条记录rn 1.我的目录结构是这样的rn [img=https://img-bbs.csdn.net/upload/201610/12/1476286985_524587.png][/img]rn2.实体类是一个只有4个字段的javaBean,由于屏幕有限,bean没有截取全rn [img=https://img-bbs.csdn.net/upload/201610/12/1476287035_435718.png][/img]rn3.hibernate的配置文件是这样的rn [img=https://img-bbs.csdn.net/upload/201610/12/1476287109_623156.png][/img]rn4.映射文件为rn [img=https://img-bbs.csdn.net/upload/201610/12/1476287128_886809.png][/img]rn5.启动测试后的报错截图rn [img=https://img-bbs.csdn.net/upload/201610/12/1476287225_988058.png][/img]rnrn我对着文件看了无数次,映射文件也没问题,配置文件也是好好的,可以获取Session和关闭session但就是出现这个错误rn大神都来看看,帮小弟解决一下问题
处理删除操作时出现 Unknown entity: java.lang.Integer
部分关键代码rn--------Subject.hbm.xmlrn rn rn rn rn------SubjectDao:rnpublic void delete(int persistentInstance) rn log.debug("deleting Subject instance");rn try rn getHibernateTemplate().delete(persistentInstance);//这是第57行rn log.debug("delete successful");rn catch (RuntimeException re) rn log.error("delete failed", re);rn throw re;rn rn rn-------SubjectBizrnpublic void deleteSubject(int subjectID)rn isubjectdao.delete(subjectID);//这是第75行rn rn--------SubjectActionrnpublic String deleteSubject()rn isubjectbiz.deleteSubject(subjectId);rn return SUCCESS;rn rn--------Struts.xmlrnrn /FenYeSubjectAction.actionrn rnrn我用的是Struts2,Hibernate,Spring框架做的rn老是报一下错误(精简下):rnorg.hibernate.MappingException: Unknown <em>entity</em>: java.lang.Integerrn org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)rn org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)rn org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:78)rn org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52)rn org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766)rn org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)rn org.springframework.orm.hibernate3.HibernateTemplate$25.doInHibernate(HibernateTemplate.java:852)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)rn org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:846)rn org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:842)rn com.dao.SubjectDAO.delete(SubjectDAO.java:57)rn com.biz.SubjectBiz.deleteSubject(SubjectBiz.java:75)rn这是什么情况啊,有没有大侠知道,指点一下.
entity">Exception in thread "main" org.hibernate.MappingException: Unknown entity
配置文件rn[code=XML]rnrn rootrn rn jdbc:mysql://localhost:3306/hibernatern rn rn org.hibernate.dialect.MySQLDialectrn rn rn hibernate_testrn rn rootrn rn com.mysql.jdbc.Driverrn rn truern rnrn[/code]rnrn实体类rn[code=Java]rnpackage com.bjsxt.hibernate.model;rnrnimport javax.persistence.Id;rnimport org.hibernate.annotations.Entity;rn@Entityrnrnpublic class Teacher rn private int id;rn private String name;rn private String title;rn @Idrn public int getId() rn return id;rn rn public void setId(int id) rn this.id = id;rn rn public String getName() rn return name;rn rn public void setName(String name) rn this.name = name;rn rn public String getTitle() rn return title;rn rn public void setTitle(String title) rn this.title = title;rn rnrn[/code]rnrn测试类rn[code=Java]rnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.cfg.AnnotationConfiguration;rnimport org.hibernate.cfg.Configuration;rnimport com.bjsxt.hibernate.model.Teacher;rnrnpublic class TeacherTest rn public static void main(String args[]) throws Exception rn Teacher t = new Teacher();rn t.setId(1);rn t.setName("daqian");rn t.setTitle("中级");rnrn Configuration cfg = new AnnotationConfiguration();rn SessionFactory sf = cfg.configure().buildSessionFactory();rn Session session = sf.openSession();rn session.beginTransaction();rn session.save(t);rn session.getTransaction().commit();rn session.close();rn sf.close();rn rnrnrn[/code]rnrnrn配置文件里面我已经配置好了,为什么还是找不到Teacher这个雷达饿
hibernate出错,org.hibernate.MappingException: Unknown entity: com.yourcompany.struts.form.UserNameForm
和struts结合,com.yourcompany.struts.form.UserNameForm是formbean,老是抱unkown <em>entity</em>错误,这是hbm文件:rnrnrnrn rnrnrnrnrnrnrn
使用Hibernate操作,出现Unknown entity异常
大家好,刚接触配置类的东西,好多依葫芦画瓢,没弄懂。这次碰上一个东西,直接闷了,麻烦大家帮我看下。rnapplicationContext.xml 配置文件中,我添加了一行代码。rnrn rn rn rn rn rn com/itoss/db/<em>entity</em>/AttrAlarm.hbm.xmlrn [color=#FF0000] com/itoss/db/<em>entity</em>/ZltdGps.hbm.xml[/color]rnrn rn就添加了红色的那行代码,程序报了异常。rn----------------------------------------rn异常的具体信息如下rn---------------------------------rnorg.springframework.orm.hibernate3.HibernateSystemException: Unknown <em>entity</em>: com.itoss.db.<em>entity</em>.ZltdGps; nested exception is org.hibernate.MappingException: Unknown <em>entity</em>: com.itoss.db.<em>entity</em>.ZltdGpsrn at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)rn at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)rnrnrnrn其他文件如下配置:rn--------------------------------rnhibernate.cfg.xmlrn添加如下rn-----------------------------------rnrn rnrn rnrn--------------------------------------------rnapplicationContext_beans.xmlrn添加如下rn------------------------------------------rnrnrnrnrn rnrnrn------------------------------------------rnZltdGps.hbm.xmlrn配置如下:rn------------------------------rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn----------------------------------------------------------------rn查了一天的资料,能改的地方,我感觉都动过了。各位高手帮我看下,问题究竟出在哪里?rn
被hibernate伤害了 Unknown entity: com.ambition.entity.Grade
跟着慕课网的hibernate初探之一对多映射,做到第一个实例就出错了下面是代码rnhibernate.cfg.xml:rn[code=java]rnrnrnrnrnrnrnrnrn rn rn org.hibernate.dialect.MySQLDialectrn rn rn rn com.mysql.jdbc.Driverrn rn rn rn jdbc:mysql://localhost:3306/hibernatetest?<em>use</em>Unicode=true&characterEncoding=utf8rn rn rn rootrn 954552106rn truern updaternrn rn rnrnrnrnrn[/code]rnrncom.ambition.util.HibernateUtil.java:rn[code=java]rnpackage com.ambition.util;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.boot.registry.StandardServiceRegistry;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnimport org.hibernate.cfg.Configuration;rnrnpublic class HibernateUtil rn rn private static SessionFactory sessionFactory;rn private static Session session;rn rn staticrn rn //创建Configuration对象,读取hibernate.cfg.xml文件,完成初始化rn Configuration configure = new Configuration().configure();rn StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder()rn .applySettings(configure.getProperties());rn StandardServiceRegistry ssr = ssrb.build();rn sessionFactory = configure.buildSessionFactory(ssr);rn rn rn public static SessionFactory getSessionFactory()rn return sessionFactory;rn rn rn public static Session getSession()rn session = sessionFactory.openSession();rn return session;rn rn rn public static void closeSession(Session session)rn if(session!=null)rn session.close();rn rn rnrnrn[/code]rnrncom.ambition.<em>entity</em>.Grade.java:rn[code=java]package com.ambition.<em>entity</em>;rnrnimport java.io.Serializable;rnimport java.util.HashSet;rnimport java.util.Set;rnrnrnpublic class Grade implements Serializable rn rn private int gid;rn private String gname;rn rn public Grade(String gname, String gdesc) rn this.gname = gname;rn this.gdesc = gdesc;rn rn public Grade() rn rn public int getGid() rn return gid;rn rn public void setGid(int gid) rn this.gid = gid;rn rn public String getGname() rn return gname;rn rn public void setGname(String gname) rn this.gname = gname;rn rn public String getGdesc() rn return gdesc;rn rn public void setGdesc(String gdesc) rn this.gdesc = gdesc;rn rn public Set getStudents() rn return students;rn rn public void setStudents(Set students) rn this.students = students;rn rn private String gdesc;rn private Set students = new HashSet();rnrnrn[/code]rnrncom.ambition.<em>entity</em>.Student.java:rn[code=java]package com.ambition.<em>entity</em>;rnrnimport java.io.Serializable;rnrnpublic class Student implements Serializable rnrn private int sid;rn private String sname;rn private String sex;rn public int getSid() rn return sid;rn rn public void setSid(int sid) rn this.sid = sid;rn rn public Student(String sname, String sex) rn super();rn this.sname = sname;rn this.sex = sex;rn rn public String getSname() rn return sname;rn rn public void setSname(String sname) rn this.sname = sname;rn rn public String getSex() rn return sex;rn rn public void setSex(String sex) rn this.sex = sex;rn rn rnrn[/code]rnrncom.ambition.<em>entity</em>.Test.java:rn[code=java]package com.ambition.<em>entity</em>;rnrnrnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.ambition.util.HibernateUtil;rnrnpublic class Test rnrn public static void main(String[] args) rn add();rn rn rn public static void add()rn Grade g = new Grade("java1班","java工程试验1班");rn Student s1 = new Student("李明","男");rn Student s2 = new Student("小红","女");rn g.getStudents().add(s1);rn g.getStudents().add(s2);rn Session session = HibernateUtil.getSession();rn Transaction t = session.beginTransaction();rn session.save(g);rn session.save(s1);rn session.save(s2);rn t.commit();rn HibernateUtil.closeSession(session);rn rn rnrn[/code]rnrncom.ambition.<em>entity</em>.Grade.hbm.xml:rn[code=text]rnrnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrncom.ambition.<em>entity</em>.Student.hbm.xml:rn[code=text]rnrnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rn错误如下:rn[code=text]一月 24, 2016 4:30:19 下午 org.hibernate.Version logVersionrnINFO: HHH000412: Hibernate Core 5.0.7.Finalrn一月 24, 2016 4:30:19 下午 org.hibernate.cfg.Environment rnINFO: HHH000206: hibernate.properties not foundrn一月 24, 2016 4:30:19 下午 org.hibernate.cfg.Environment buildBytecodeProviderrnINFO: HHH000021: Bytecode provider name : javassistrn一月 24, 2016 4:30:19 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager rnINFO: HCANN000001: Hibernate Commons Annotations 5.0.1.Finalrn一月 24, 2016 4:30:19 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configurernWARN: HHH10001002: Using Hibernate built-in connection pool (not for production <em>use</em>!)rn一月 24, 2016 4:30:19 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernatetest?<em>use</em>Unicode=true&characterEncoding=utf8]rn一月 24, 2016 4:30:19 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001001: Connection properties: <em>use</em>r=root, password=****rn一月 24, 2016 4:30:19 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001003: Autocommit mode: falsern一月 24, 2016 4:30:19 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections rnINFO: HHH000115: Hibernate connection pool size: 20 (min=1)rn一月 24, 2016 4:30:20 下午 org.hibernate.dialect.Dialect rnINFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialectrn一月 24, 2016 4:30:20 下午 org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl <em>use</em>ContextualLobCreationrnINFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4rnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: com.ambition.<em>entity</em>.Gradern 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.ambition.<em>entity</em>.Test.add(Test.java:23)rn at com.ambition.<em>entity</em>.Test.main(Test.java:12)[/code]
org.springframework.orm.hibernate3.HibernateSystemException: a different object
框架是:hibernate3+spring2.5rn这个问题是我连续两次想要get一个实体类得时候出现的,字面意思是在hibernate中同一个session里面有了两个相同标识,但是是不同实体。纠结了很多天都没答案。rnrn[code=Java]rnpublic User getUserById(int id) rn User u = new User();rn u = (User)this.hibernateTemplate.get(User.class, id);rn return u;rnrn[/code]rn调用这个方法的代码为:rn[code=Java]rnUser u1 = (User)us.getUserById(35);rnUser u2 = (User)us.getUserById(51);rn[/code]rn请各位帮帮忙,网上说的1、session.clean();2、session.refresh(object);3、session.merge(object)rn都没有用啊rnrnrn
org.springframework.orm.hibernate3.HibernateSystemException: No Dialect mapping
org.springframework.orm.hibernate3.HibernateSystemException: No Dialect mapping for JDBC type: -9; nested exception is org.hibernate.MappingException: No Dialect mapping for JDBC type: -9rn 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.execute(HibernateTemplate.java:339)rn哪位大侠知道这是什么错吗?找了半天找不出来错在哪里,我的方言配置好了[code=XML]rn rn rn org.hibernate.dialect.SQLServerDialectrn rn rn truern rn rn [/code]
entity: dd.Person">hibernate出错,Exception in thread "main" org.hibernate.MappingException: Unknown entity: dd.Person
[code=XML][/code]不知道哪里的配置出了错误,望高手指点。用myeclipse6.0做测试rnhibernate.cfg.xml 放在src下,到文件目录去看的话,WEB-INF/classes下也是有的,只不过myeclipse看不到classes这个目录。rnhibernate.cfg.xmlrn[code=XML]rnrnrnrnrnrnrn oraclern rn jdbc:oracle:thin:@127.0.0.1:1521:orclrn rn ttrn ttrn rn oracle.jdbc.driver.OracleDriverrn rn rn org.hibernate.dialect.Oracle9Dialectrn rnrnrnrn[/code]rnrnPerson.hbm.xml 和hibernate.cfg.xml 在同一目录下rn[code=XML]rnrnrnrnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rn数据库的建表语句rn[code=SQL]DROP TABLE person ;rnrnCREATE TABLE personrn(rn id varchar(32) not null primary key ,rn name varchar(20) not null ,rn password varchar(20) not null ,rn sex varchar(2) ,rn email varchar(30)rn) ;rnrn-- 事务提交:rncommit ;[/code]rnrn
Hibernate Dao类 映射Class “Unknown entity” 急在线等~~!
使用SSH2rn连接MySQLrnrnrn数据库:rnrnmysql> desc student;rn+--------+------------------+------+-----+---------+----------------+rn| Field | Type | Null | Key | Default | Extra |rn+--------+------------------+------+-----+---------+----------------+rn| S_no | int(10) unsigned | NO | PRI | NULL | auto_increment |rn| S_name | varchar(45) | NO | | NULL | |rn| S_sex | varchar(45) | NO | | NULL | |rn| S_age | varchar(45) | NO | | NULL | |rn+--------+------------------+------+-----+---------+----------------+rnrn实体类rnrn@Entityrn@Table(name="student",schema="test")rnpublic class Student implements java.io.Serializable rnrn private String sNo;rn private String sName;rn private String sSex;rn private String sAge;rnrn public Student() rn rnrn public Student(String sName, String sSex, String sAge) rn this.sName = sName;rn this.sSex = sSex;rn this.sAge = sAge;rn rnrn @Idrn @GeneratedValue(strategy = GenerationType.AUTO) rn @Column(name="S_no")rn public String getSNo() rn return this.sNo;rn rnrn public void setSNo(String sNo) rn this.sNo = sNo;rn rn @Column(name="S_name")rn public String getSName() rn return this.sName;rn rn …………rn ……rnrnspring配置文件rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.MySQLDialectrn rn truern rn org.hibernate.cache.EhCacheProviderrn rn rn rn rn rn rn rn org/workflow/<em>entity</em>/Studentrn rn rn rnrn其它的都没问题rn就运行到 DAO类的时候调用 rnthis.getHibernateTemplate().get()的时候rn提示 Unknown <em>entity</em>: org.workflow.<em>entity</em>.Student rnrn在 this.getHibernateTemplate() 之前 有输出 rnSystem.out.println(Student.class);rn输出的内容是 :class org.workflow.<em>entity</em>.Student rnrn请教,问题出在哪,spring 文件以前连接ORACLE的时候一直都是这样配置的没问题rn这次用Mysql 的时候 就出错了,是不是忘了哪一步?
请教hibernate高手 Unknown entity class: java.lang.Long 异常 在线等
在session.seave(bean);rn的时候报下面异常 请问是怎么回事呀?在线等!谢谢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
初学Nhibernate,狂报Unknown entity class: BlueF_EduSys.Domain.CUSTOMER
相应实体配置文件的生成操作已经改为了“签入资源”rnrnrnrn这个问题困扰我很长时间了,请大家帮忙解决啊,踊跃发言,我在网上看了好多这样的问题,好像都没有被解决。rnrn没想到Nhibernate这么难,这么多人都不会,期待高手的降临。rn
jeecg前台添加数据是出现unknown entity的解决方法
[org.jeecgframework.core.common.exception.GlobalExceptionResolver]全局处理异常 property mapping has wrong number of columns: com.admin.<em>entity</em>.message.messageEntity; 按照异常提示ca<em>use</em>d by:我的一方面是注解反回Object失败,便把
单独使用Hibernate时,出现Unknown Entity异常
先上图rnrn工程的文件结构rn[img=https://img-bbs.csdn.net/upload/201606/04/1465044625_835811.png][/img]rnrnhibernate.cfg.xmlrn[code=html]rnrnrn rn rn com.mysql.jdbc.Driverrn rn jdbc:mysql://localhost/hibernatern rn rootrn rn dongzhong1990rn 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]rnrnrnNews.javarn[code=java]package org.crazyit.app.domain;rnrnimport javax.persistence.*;rn/**rn * Description:rn * 网站: 疯狂Java联盟rn * Copyright (C), 2001-2016, Yeeku.H.Leern * This program is protected by copyright laws.rn * Program Name:rn * Date:rn * @author Yeeku.H.Lee kongyeeku@163.comrn * @version 1.0rn */rn@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 rnrn // 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 rnrn // 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 rn[/code]rnrnrnNewsManager.javarn[code=java]package lee;rnrnimport org.hibernate.*;rnimport org.hibernate.cfg.*;rnimport org.hibernate.service.*;rnimport org.hibernate.boot.registry.*;rnimport org.crazyit.app.domain.*;rnrn/**rn * Description:rn * 网站: 疯狂Java联盟rn * Copyright (C), 2001-2016, Yeeku.H.Leern * This program is protected by copyright laws.rn * Program Name:rn * Date:rn * @author Yeeku.H.Lee kongyeeku@163.comrn * @version 1.0rn */rnpublic class NewsManagerrnrn public static void main(String[] args)rn throws Exceptionrn rn // 实例化Configuration,rn Configuration conf = new Configuration()rn // 不带参数的configure()方法默认加载hibernate.cfg.xml文件,rn // 如果传入abc.xml作为参数,则不再加载hibernate.cfg.xml,改为加载abc.xmlrn .configure();rn 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("疯狂Java联盟成立了");rn n.setContent("疯狂Java联盟成立了,"rn + "网站地址http://www.crazyit.org");rn // 保存消息rn sess.save(n);rn // 提交事务rn tx.commit();rn // 关闭Sessionrn sess.close();rn sf.close();rn rnrn[/code]rnrnrn嗯。。。没错,我是照着书上一点没变的打上去的,可是一运行就会产生下面的错误rn[code=java]INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetExceptionrnException in thread "main" org.hibernate.MappingException: Unknown <em>entity</em>: org.crazyit.app.domain.Newsrn at org.hibernate.internal.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:776)rn at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1533)rn at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)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:682)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:674)rn at org.hibernate.internal.SessionImpl.save(SessionImpl.java:669)rn at lee.NewsManager.main(NewsManager.java:44)rn[/code]rnrn而且在网上搜到的办法基本就是说导入的包的问题,配置文件的问题,函数库的问题。。可是这些我都试过了,都没有解决。甚至重新建立项目都还是会出现异常。希望大神们能够帮帮我。
hibernate Unknown entity错误,google,baidu后无法解决,求助
情况如图rn[img=https://img-bbs.csdn.net/upload/201702/27/1488201856_826972.png][/img]rnrn代码:rnhibernate.cfg.xml:rn[code=text]rnrnrnrn rn jdbc:sqlserver://localhost:1433;DatabaseName=mysql rn sa rn 12345 rn com.microsoft.sqlserver.jdbc.SQLServerDriver rn org.hibernate.dialect.SQLServerDialect rn true rn truern org.hibernate.dialect.SQLServerDialectrn rn rn rnrn[/code]rnUser.hbm.xml 代码:rn[code=text]rnrnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rnrn[/code]rnrnHibernateUtil代码rn[code=java]rnpackage hibernate_test;rnrnrnimport org.hibernate.HibernateException;rnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.cfg.Configuration;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnimport org.hibernate.service.ServiceRegistry;rnrnrnpublic class HibernateUtil rn private static final ThreadLocal threadlocal=new ThreadLocal();rn private static SessionFactory sessionFactory=null;rn private static ServiceRegistry serviceRegistry =null;rn staticrn try rn // Create the SessionFactory from hibernate.cfg.xmlrn Configuration configuration = new Configuration();rn configuration.configure("hibernate.cfg.xml");rn System.out.println("Hibernate Configuration loaded");rn rn // configuration.addClass(hibernate_test.User.class);rn // Read mappings as a application resourceNamern // addResource is for add hbml.xml files in case of declarative approachrn configuration.addResource("User.hbm.xml"); //rn rn //apply configuration property settings to StandardServiceRegistryBuilderrn serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();rn System.out.println("Hibernate serviceRegistry created");rn rn sessionFactory = configurationrn .buildSessionFactory(serviceRegistry);rn rn catch (Throwable ex) rn // Make sure you log the exception, as it might be swallowedrn System.err.println("Initial SessionFactory creation failed." + ex);rn throw new ExceptionInInitializerError(ex);rn rn rn /**rn * attain sessionrn * @return Sessionrn * @throws HibernateExceptionrn */rn public static Session getSession() throws HibernateExceptionrn Session session=(Session) threadlocal.get();rn if(session==null||!session.isOpen())rn if(session==null) rn rebuildSessionFactory();rn rn session=(sessionFactory!=null)?sessionFactory.openSession():null;rn threadlocal.set(session);rn rn System.out.println("***crating session");rn return session;rn rn /**rn * rebuild SessionFactoryrn */rn public static void rebuildSessionFactory()rn tryrn Configuration configuration=new Configuration().configure();rn rn sessionFactory=configuration .buildSessionFactory(serviceRegistry);rn catch(Exception e)rn System.err.println("build sessionFactory fail");rn e.printStackTrace( );rn rn rn /**rn * attain object of SessionFactory rn * @return object of SessionFactoryrn */rn public static SessionFactory getSessionFactory()rn return sessionFactory;rn rn /**rn * close Sessionrn * @throws HibernateExceptionrn */rn public static void closeSession() throws HibernateExceptionrn Session session=(Session) threadlocal.get();rn threadlocal.set(null);rn if(session!=null)rn session.close();rn rnrn[/code]rnrnMainTest代码:rn[code=java]rnpackage hibernate_test;rnrnimport org.hibernate.Session;rnrnpublic class MainTest rnrn public static void main(String[] args) rn User <em>use</em>r=new User();rn <em>use</em>r.setId(123);<em>use</em>r.setName("Rosand");<em>use</em>r.setPassword("admin");rn Session session=null; rn tryrn session=HibernateUtil.getSession();rn session.beginTransaction(); rn session.save(<em>use</em>r);rn session.getTransaction().commit();rn System.out.println("success"); rn catch(Exception e)rn session.getTransaction().rollback();rn System.out.println("fail"); rn e.printStackTrace( );rn finallyrn HibernateUtil.closeSession();rn rn rnrnrn[/code]rnrn
Hibernate 第一个程序的问题Unknown entity(新手必看)
一、在Eclipse下建立Java工程HibernateDemo二、新建lib文件夹导入hibernate/ required文件夹下的包以及数据库所需要的包我下的是hibernate版本为: hibernate-release-5.2.10.Final 用的是MySQL数据库,包为: mysql-connector-java-5.1.39-bin.jar 导入之后要Buil
HIbernate 5 测试连接出现的 Unknown entity异常
异常如下: 测试代码:import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.re
use
我想在DREAMWEAVER中用PHP程序,应在下载并释放了压缩PHP文件后,再怎样配置php.ini,还有其他要注意或改的吗?谢谢!!!
USE
求USE程序开发资料,分数全给了,急求!!!
进行添加操作org.springframework.orm.hibernate3.HibernateSystemException:this id genera
报出的错误rn org.springframework.orm.hibernate3.HibernateSystemException: this id generator generates long, integer, short; nested exception is org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, shortrn org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:676)rn org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)rn org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)rn org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)rn org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:748)rn hib.M<em>use</em>rDAO.insert(M<em>use</em>rDAO.java:187)rn cmd.ActionInfo.insert(ActionInfo.java:67)rn sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn java.lang.reflect.Method.invoke(Method.java:597)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)rn com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)rnrnrnhbm.xml配置文件rnrn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnaction类写法rnpublic String insert() //用户注册rn password = m.getMD5ofStr(i<em>use</em>rpass);rn Madmin dmin = new Madmin();rn dmin.setAdminid(i<em>use</em>rname);rn dmin.setAdminpass(password);rn madmindao.save(dmin);rn return "input";rn rnrnrnrndao层被调用的写法rnpublic void save(Madmin transientInstance) rn getHibernateTemplate().save(transientInstance); rn}rnrnrn数据库中的主键我设置为number类型的rnrnrnrnrnrnrnrnrnrnrnrn
Unknown Treasure
Problem DescriptionnOn the way to the next secret treasure hiding place, the mathematician discovered a cave <em>unknown</em> to the map. The mathematician entered the cave beca<em>use</em> it is there. Somewhere deep in the cave, she found a treasure chest with a combination lock and some numbers on it. After quite a research, the mathematician found out that the correct combination to the lock would be obtained by calculating how many ways are there to pick m different apples among n of them and modulo it with M. M is the product of several different primes.n nnInputnOn the first line there is an integer T(T≤20) representing the number of test cases.nnEach test case starts with three integers n,m,k(1≤m≤n≤1018,1≤k≤10) on a line where k is the number of primes. Following on the next line are k different primes p1,...,pk. It is guaranteed that M=p1⋅p2⋅⋅⋅pk≤1018 and pi≤105 for every i∈1,...,k.n nnOutputnFor each test case output the correct combination on a line.n nnSample Inputn1n9 5 2n3 5n nnSample Outputn6
for unknown purpose
it is a rubbish, nonsense
UnKnown DATABASE?
已经在INTERBASE里建立了数据库 MYDATA 了rn也在BDE里设置好了别名DBDATA 并指向数据库的路径了,为什么还会出现这个提示呢?rnrnProject gc.exe raised exception class EDBEngineError with message'UnKnown rndatabase.rnUnable to complete network request to host"IB_SERVER".rnFailed to locate host machine.rnThe specified name was not found in thernGeneral SQL error.rnhosts file or Domain Name Services.rnAlias:my data'.Process stopped.rnrn该怎么办呢?
linq to entityentity sql 性能
一个是用linq to <em>entity</em>写的rn一个是<em>entity</em> sql写的rn性能杂差别老大呢rnrnlinq to <em>entity</em>rn100000rn00:00:00.8281250 rn基本在0.8-1之间rnrn<em>entity</em> sqlrn100000rn00:00:00.3593750 rn基本在0.3-0.5之间rnrn都是加载10W条数据rnrn[code=csharp]rnrn IEnumerable query = (rn db.fs_news.OrderByDescending(fn => fn.Click).Join(rn db.fs_news_Class, fn => fn.ClassID, fc => fc.ClassID, (fn, fc) =>rn new HanModel.Models.ViewModel.Fs_NewsOrClassrn rn newsid = fn.Id,rn newsTitle = fn.NewsTitle,rn class_ename = fc.ClassEName,rn class_type = fc.Type_Newrn )).Take(100000).ToList();rn return query;rnrn===============================================================rn string sql = "select top 100000 fn.id,fn.newstitle,fc.classename,fc.type_new from fs_news as fn inner join fs_news_class as fc on fn.classid=fc.classid order by fn.click desc";rn var cmd = db.Database.Connection.CreateCommand();rn db.Database.Connection.Open();rn cmd.CommandText = sql;rn List fslist = new List();rn using (var reader = cmd.ExecuteReader(System.Data.CommandBehavior.SequentialAccess))rn rn while (reader.Read())rn rn HanModel.Models.ViewModel.Fs_NewsOrClass fs = new HanModel.Models.ViewModel.Fs_NewsOrClass();rn fs.newsid = Convert.ToInt32(reader["id"]);rn fs.newsTitle = reader["newstitle"].ToString();rn fs.class_ename = reader["classename"].ToString();rn fs.class_type = reader["type_new"].ToString();rn fslist.Add(fs);rn rn reader.Close();rnrn rnrn db.Database.Connection.Close();rn return fslist;rnrn[/code]
Business Use Case与Use Case
请问Business Use Case与Use Case的关系?rn怎样区分Business Use Case与Use Case呢?
java entity
java annotation实体关系映射,涉及各种实体间的关系
Entity 监听器
问题描述 数据导入,因为ID业务无关性,在多系统中,需要添加code进行对象唯一性标识。 某些实体,其code为国家规定,需要用户输入,某些国家未规定代码的实体,我们需要为其设置一个不重复的代码作为标识。 最初 为了保证每次运行系统,该代码不重复,所以新建一张code表用于存储不同的实体的code编号到多少了,以保证不重复。 为了让每个人...
Entity Frame
多个帐套之间的切换:EF中不能存在具体的库的数值!
CSV to Entity
CSV 2 Entity 框架, 这个框架可以根据CSV文件,建立C#和VB类,并实现读入到类,从类写出等。 还有文档功能。
Entity Framework
实体框架学习和以及EF与Linq的结合的使用方法,明确EF的机制,并应用到开发过程中
linq to entity
linq连接数据库,linq学习例子,linq to entiry,比ADO.NET要简单、省时、高效。
Linq to Entity
数据库连接 Linq to Entity
javax.ejb.EJBException: No such entity!
请问各位导致这个错误的原因??
Visual Entity
Visual Entity 是一款实体类代码生成器,基于 Visual Studio 插件。并且在使用上与 Linq to SQL 设计器保持一致,极易上手,但功能比起原有的 Linq to SQL 设计器更为强大
无法加载Entity
Hibernate: select auction<em>use</em>0_.AU_USER_ID as AU1_2_0_, auction<em>use</em>0_.AU_USER_NAME as AU2_2_0_, auction<em>use</em>0_.AU_PASSWORD as AU3_2_0_, auction<em>use</em>0_.AU_IDENTITY_CODE as AU4_2_0_, auction<em>use</em>0_.AU_PHONE as AU5_2_0_, auction<em>use</em>0_.AU_ADDRESS as AU6_2_0_, auction<em>use</em>0_.AU_POSTCODE as AU7_2_0_, auction<em>use</em>0_.AU_STATUS as AU8_2_0_ from SA.AUCTION_USER auction<em>use</em>0_ where auction<em>use</em>0_.AU_USER_ID=?rnorg.hibernate.exception.GenericJDBCException: could not load an <em>entity</em>: [<em>entity</em>.AuctionUser#3]rn at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)rn at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)rn at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)rn at org.hibernate.loader.Loader.loadEntity(Loader.java:1899)rn at org.hibernate.loader.<em>entity</em>.AbstractEntityLoader.load(AbstractEntityLoader.java:71)rn at org.hibernate.loader.<em>entity</em>.AbstractEntityLoader.load(AbstractEntityLoader.java:65)rn at org.hibernate.persister.<em>entity</em>.AbstractEntityPersister.load(AbstractEntityPersister.java:3062)rn at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434)rn at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415)rn at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165)rn at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:207)rn at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)rn at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:843)rn at org.hibernate.impl.SessionImpl.get(SessionImpl.java:836)rn at dao.UserDao.findById(UserDao.java:26)rn at dao.UserDao.main(UserDao.java:94)rnCa<em>use</em>d by: java.sql.SQLException: 数字溢出rn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)rn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)rn at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)rn at oracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:7465)rn at oracle.jdbc.driver.NumberCommonAccessor.getInt(NumberCommonAccessor.java:103)rn at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:521)rn at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)rn at org.hibernate.type.IntegerType.get(IntegerType.java:51)rn at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)rn at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)rn at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)rn at org.hibernate.persister.<em>entity</em>.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2114)rn at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)rn at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)rn at org.hibernate.loader.Loader.getRow(Loader.java:1230)rn at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)rn at org.hibernate.loader.Loader.doQuery(Loader.java:724)rn at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)rn at org.hibernate.loader.Loader.loadEntity(Loader.java:1885)rn ... 13 morernException in thread "main" java.lang.NullPointerExceptionrn at dao.UserDao.main(UserDao.java:95)rnrn AuctionUser <em>use</em>r=null;rn Session session=null;rn try rn session=HibernateSessionFactory.getSession();rn// Criteria criteria=session.createCriteria(AuctionUser.class);rn// criteria.add(Restrictions.eq("auid", id));rn// <em>use</em>r=(AuctionUser)criteria.uniqueResult();rn <em>use</em>r=(AuctionUser)session.get(AuctionUser.class, id);rn catch (Exception e) rn e.printStackTrace();rn finallyrn session.close();rn rn return <em>use</em>r;rnrn各位高手帮小弟看下 万分感谢rn
entity的问题!
我的xmlrnrn rn报错rnReference to undefined <em>entity</em> 'nbsp'. Error processing resource rn我怎么才能纠正这个错误,像在html中一样使用 呢?
entity 查询
[code=C#][/code] rn var i = this.UserManager.Get(Int32.Parse(this.User.Id<em>entity</em>.Name));//得到当前登录用户rn //得到此用户在ProTypeAuth的记录列表rn var j = this.ProTypeAuthManager.LoadAllQueryable().Where(p=>p.<em>use</em>r.ID==i.ID).ToList();rn //将此用户在ProTypeAuth中的字段ManufNo的值存入数组rn string[] array = new string[j.Count()];rn int a=0;rn foreach(var l in j)rn rn array[a] = l.manufauth.ManufNo;rn a++;rn //这里可以将此数组转化成("a","b","c")的形式rnrn DateTime 收租期 = DateTime.Now.AddMonths(1);rn var paylist = this.PaymentManager.LoadAllQueryable().Where(<em>entity</em> =>rn <em>entity</em>.AccrualDate < new DateTime(收租期.Year, 收租期.Month, 1)rn && <em>entity</em>.State == falsern && <em>entity</em>.product.IsPayOver == falsern [color=#FF0000] //这里查询要实现类似于IN的作用,但是这里不支持IN,请问有什么办法啊[/color]rn //&& (<em>entity</em>.product.proType.manufacturer.ManufNo in ("a","b","c"))rn &&(<em>entity</em>.product.proType.manufacturer.ManufNo.Contains(array[0]))rn );
entity framework
方便的数据库操作框架,甚至于没有可见的sql 语言。 让数据库编程更加方便。
Entity Framework in not in
.Get().Where(p => new int[] 74169, 74170, 74171 .Contains(p.nID)).ToList();rnrn这样是有效的,但是换成rnrnint[] ids = new int[] 74169, 74170, 74171 ;rn.Get().Where(p => new int[] 74169, 74170, 74171 .Contains(p.nID)).ToList();rnrn这样就没有效果了rnrnrnrn求教~
Entity framework
在网上看到一些关于Entity framework的例子。。愣是看不出他们是怎么连接数据库的!!请问是不是像ASP.NET那样连接数据库,各位能否举个例子
hibernate ENTITY
有一个实体BEANrn@Entityrn@Table(name="WF_NROUTE_TBL")rnpublic class WfNrouteTbl rn @ManyToOne(fetch=FetchType.LAZY)rn @JoinColumn(name="m_id",referencedColumnName="id")rn private WfIdChTbl idTbl;rn private Integer last_flg;rn @EmbeddedIdrn private WfNroutePK nrountePk;rn private Integer nrtno;rn private Integer spc_flg;rnrn如上所示 WF_NROUTE_TBL 表中放一字段M_ID 、该字段中既可以放用户ID也可以放部门IDrn我在WfNrouteTbl 实体中作了一个关系rn@ManyToOne(fetch=FetchType.LAZY)rn@JoinColumn(name="m_id",referencedColumnName="id")rnprivate WfIdChTbl idTbl;rnWfNrouteTbl 实体中M_ID属性就不能要了rn现在的问题时我怎样读到WfNrouteTbl实体的M_ID属性rn如果WF_NROUTE_TBL 中放的是用户IDrn我可以用getIdTbl().getId取得rn如果放的是部门rn则根本取不到rn该怎样取到M_ID?rn谢谢!
entity识别
A Bootstrapping Method for Learning Semantic Lexicons using Extraction Pattern Contexts 输入:1,不同种类的种子集合;2,语料库首先用autoslog从语料库中抽取所有相关的模式,这些模式都只是用来识别名词。启发式的抽取pattern的规则定义入下图 然后用这些模式从语料库里抽取所有的名词,将模式以及抽
震荡波病毒源代码文件(仅供研究)下载
当年非常恶心的震荡波代码... :) ROMANIAN SECURITY RESEARCH 2004 - Sasser Worm ftpd Remote Buffer Overflow Exploit sasser v[a-e] exploit (of its ftpd server) exploit version 1.3, not private anymore author: mandragore date: Tue May 4 13:32:38 2004 vuln type: SEH ptr overwriting greets: rosecurity team discover 相关下载链接:[url=//download.csdn.net/download/wuqilv123/2899136?utm_source=bbsseo]//download.csdn.net/download/wuqilv123/2899136?utm_source=bbsseo[/url]
javascript dropdownlist 三级联动的资料下载
搜集的关于 javascript 下拉菜单 三级联动的 一些 资料,有些实例,省市区 三级 联动那个挺好的 相关下载链接:[url=//download.csdn.net/download/qq379797807/3990808?utm_source=bbsseo]//download.csdn.net/download/qq379797807/3990808?utm_source=bbsseo[/url]
图片反色VB源代码下载
图片反色VB源代码 相关下载链接:[url=//download.csdn.net/download/u011847153/6022821?utm_source=bbsseo]//download.csdn.net/download/u011847153/6022821?utm_source=bbsseo[/url]
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数
我们是很有底线的