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

原文地址:https://www.cnblogs.com/huyuchengus/p/12682974.html