简体   繁体   中英

Hibernate Properties or configuration file to use

For hibernate project what is recommended to use hibernate.properties file or hibernate.cfg.xml file. What to use??

And please can u also specify why to use properties instead configuration and vice versa

which use is best hibernate.properties file OR hibernate.cfg.xml file

The hibernate.properties is the old way to represent the connection information, for newest versions (2.0+), it has been replaced by the XML-based configuration file, since it is more flexible and has more features.

However, there's a thread explaining how to combine them both, you should have a look at this thread: How to use hibernate.properties file instead of hibernate.cfg.xml .

You should also have a look to the Hibernate documentation http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html , chapter 3.7. XML configuration file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM