Unknown entity,该怎么解决

Unknown entity,该怎么解决,第1张

orghibernateMappingException: Unknown entity异常是新手学习hibernate的时候经常遇到的问题,这值得注意一下。下边是异常截图
orghibernateMappingException: Unknown
1
orghibernateMappingException: Unknown entity异常详细信息如下:
orghibernateMappingException: Unknown entity: comgis520modelEmp_emp
at orghibernateimplSessionFactoryImplgetEntityPersister(SessionFactoryImpljava:628)
at orghibernateimplSessionImplgetEntityPersister(SessionImpljava:1366)
at orghibernateeventdefAbstractSaveEventListenersaveWithGeneratedId(AbstractSaveEventListenerjava:121)
at orghibernateeventdefDefaultSaveOrUpdateEventListenersaveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListenerjava:210)
at orghibernateeventdefDefaultSaveEventListenersaveWithGeneratedOrRequestedId(DefaultSaveEventListenerjava:56)
at orghibernateeventdefDefaultSaveOrUpdateEventListenerentityIsTransient(DefaultSaveOrUpdateEventListenerjava:195)
…………
at orgjunitrunnersParentRunner$3run(ParentRunnerjava:193)
at orgjunitrunnersParentRunner$1schedule(ParentRunnerjava:52)
at orgjunitrunnersParentRunnerrunChildren(ParentRunnerjava:191)
at orgjunitrunnersParentRunneraccess$000(ParentRunnerjava:42)
at orgjunitrunnersParentRunner$2evaluate(ParentRunnerjava:184)
at orgjunitrunnersParentRunnerrun(ParentRunnerjava:236)
at orgeclipsejdtinternaljunit4runnerJUnit4TestReferencerun(JUnit4TestReferencejava:50)
at orgeclipsejdtinternaljunitrunnerTestExecutionrun(TestExecutionjava:38)
at orgeclipsejdtinternaljunitrunnerRemoteTestRunnerrunTests(RemoteTestRunnerjava:467)
at orgeclipsejdtinternaljunitrunnerRemoteTestRunnerrunTests(RemoteTestRunnerjava:683)
at orgeclipsejdtinternaljunitrunnerRemoteTestRunnerrun(RemoteTestRunnerjava:390)
at orgeclipsejdtinternaljunitrunnerRemoteTestRunnermain(RemoteTestRunnerjava:197)
END
解决方案:
原因分析1:
可能是因为使用注解的时候没有导入正确的包。要清楚,Entity包是javaxpersistenceEntity;而不是hibernate包下的annotation
原因分析2:
使用注解时没有在cfgxml下配置<mapping class=""/>,从而造成orghibernateMappingException: Unknown entity异常的原因

以上就是关于Unknown entity,该怎么解决全部的内容,包括:Unknown entity,该怎么解决、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9276380.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-26
下一篇 2023-04-26

发表评论

登录后才能评论

评论列表(0条)

保存