hibernate.cfg.xml 中如何设置 hbm.xml 和 Annotations 的 mapping

Posted huyuchengus

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hibernate.cfg.xml 中如何设置 hbm.xml 和 Annotations 的 mapping相关的知识,希望对你有一定的参考价值。

在一个 Hibernate 项目中,我们需要同时设置 hbm.xml 和 Annotations 的 mapping

这种情况 hibernate.cfg.xml 如何配置?


其实 hibernate.cfg.xml 中是可以同时设置 hbm.xml 和 Annotations 的。

例如下面的配置:

		<mapping class="com.ossez.covid19.common.models.Covid19Current"/>
		<mapping resource="hbm/api/RewsUser.hbm.xml" />

Hibernate 能够自动识别上面 2 个 mapping。

技术图片

 

https://www.cwiki.us/display/HIBERNATE/questions/57938966

以上是关于hibernate.cfg.xml 中如何设置 hbm.xml 和 Annotations 的 mapping的主要内容,如果未能解决你的问题,请参考以下文章