What is the order of precedence between hibernate.properties and hibernate.cfg.xml ?
For what I know hibernate.cfg.xml (if exists in the app's classpath) overrides hibernate.properties. Is my assumption correct ?
Thank you
cfg. xml . This file can be used as a replacement for the hibernate. properties file or, if both are present, to override properties.
Hibernate Configuration File(cfg file) is the file loaded into an hibernate application when working with hibernate. Hibernate uses this file to establish connection to the database server.It is an XML file which is used to define below information. Standard name for this file is hibernate.
Hibernate also requires a set of configuration settings related to database and other related parameters. All such information is usually supplied as a standard Java properties file called hibernate. properties, or as an XML file named hibernate. cfg.
If both hibernate. properties and hibernate. cfg. xml files are present in the classpath then hibernate.
From the documentation:
An alternative approach to configuration is to specify a full configuration in a file named hibernate.cfg.xml. This file can be used as a replacement for the hibernate.properties file or, if both are present, to override properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With