hibernate配置文件中hibernate-mapping PUBLIC和hibernate-configuration PUBLIC有什么区别?

时间:2013-04-06 03:17:12

标签: xml hibernate

在Eclipse中,我使用db浏览器自动生成hbm.xml文件。部署项目时,控制台上打印了以下异常:

无法解析资源中的映射文档。的hbm.xml。

当我将hbm.xml中的hibernate-configuration PUBLIC修改为hibernate-mapping PUBLIC时,没有异常。为什么?这两者有什么区别?

1 个答案:

答案 0 :(得分:0)

hibernate-mapping PUBLIC( For domain object mapping files only)

映射文档是一个XML文档,其根元素which包含所有元素,即为域对象创建表的元素

hibernate-configuration PUBLIC(for configuration file only )

用于提供进行数据库连接所必需的信息which。将域对象映射到数据库表的映射详细信息也是Hibernate configuration文件的一部分。