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

posted @ 2020-04-11 23:10  huyuchengus  阅读(220)  评论(0编辑  收藏  举报