The Hibernate configuration can be specified in the Hibernate Configuration File (cfg.xml), which has more configuration parameters than the properties file.
Note
Either the properties file or the configuration file can be used to specify the configuration, or both can be used. If both are provided, the configuration file overrides the properties file for the configuration parameters specified in both.
The Hibernate XML configuration file has the following advantages over the properties file:
The Hibernate configuration file is more convenient when tuning the Hibernate cache. The Hibernate configuration file has the provision to configure the Hibernate XML Mapping files.
For exporting a schema to a database using the
SchemaExport
tool, just the properties file would suffice, but for object/relational mapping of a persistence class, the Hibernate XML configuration file is a better option.
The following are the steps to create a Hibernate configuration file...