为了账号安全,请及时绑定邮箱和手机立即绑定

问题已解决:找不到Student:org.hibernate.MappingException: Unknown entity: Student

hibernate5.2.5. 运行时报错,如下:

org.hibernate.MappingException: Unknown entity: Student

org.hibernate.MappingException: Unknown entity: Student

at org.hibernate.metamodel.internal.MetamodelImpl.entityPersister(MetamodelImpl.java:620)

at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1619)

at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:104)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)

at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)

at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)

at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)

at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:674)

at org.hibernate.internal.SessionImpl.save(SessionImpl.java:666)

at org.hibernate.internal.SessionImpl.save(SessionImpl.java:661)

at StudentTest.testSaveStudent(StudentTest.java:40)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)

at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

584a20f100013bcb05000246.jpg

584a20f20001ced105000329.jpg

584a20f20001666a05000181.jpg


正在回答

4 回答

同问,注册服务是哪一行啊

0 回复 有任何疑惑可以回复我~
#1

人在梦游中 提问者

serviceregistry .. = new ServiceRegistry....
2017-02-13 回复 有任何疑惑可以回复我~
#2

人在梦游中 提问者

serviceregistry .. = new StandardServiceRegistryBuilder()....
2017-02-13 回复 有任何疑惑可以回复我~

删哪行啊??

0 回复 有任何疑惑可以回复我~
#1

人在梦游中 提问者

serviceregistry .. = new ServiceRegistry....
2017-02-13 回复 有任何疑惑可以回复我~
#2

人在梦游中 提问者

serviceregistry .. = new StandardServiceRegistryBuilder()....
2017-02-13 回复 有任何疑惑可以回复我~

怎么搞定的啊?

0 回复 有任何疑惑可以回复我~
#1

人在梦游中 提问者

把注册服务那一行删掉就可以了。不需要注册服务
2016-12-12 回复 有任何疑惑可以回复我~

问题已解决

0 回复 有任何疑惑可以回复我~
#1

慕瓜2373665

怎么解决的,我也遇到这个问题,好烦
2016-12-10 回复 有任何疑惑可以回复我~
#2

人在梦游中 提问者 回复 慕瓜2373665

把注册服务那一行删掉就可以了。不需要注册服务
2016-12-12 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

问题已解决:找不到Student:org.hibernate.MappingException: Unknown entity: Student

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信