对于 hibernate 项目,建议使用 hibernate.properties
文件或 hibernate.cfg.xml
文件。
用什么?
请您也指定为什么使用属性而不是配置,反之亦然
哪个使用最好是 hibernate.properties 文件或 hibernate.cfg.xml 文件
最佳答案
hibernate.properties是表示连接信息的旧方法,对于最新版本(2.0+),它已被基于XML的配置文件取代,因为它更灵活并且具有更多功能。
但是,有一个线程解释了如何将它们结合起来,您应该看看这个线程:How to use hibernate.properties file instead of hibernate.cfg.xml .
您还应该查看 Hibernate 文档 http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html ,第 3.7 章。 XML 配置文件。
关于java - 要使用的 Hibernate 属性或配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36710717/