Configuration class
To load configuration xml, we need to create object of Configuration class, which is given in
org.hibernate.cfg.*; package and we need to call configuration() method in that class, by passing xml configuration file name as parameter in that method
Configuration (org.hibernate.cfg.Configuration)
The Configuration class object is the first Hibernate object you create in any Hibernate
application and usually created only once during application initialization
Configuration configurationObj = new Configuration();
configurationObj.configure(“hibernate.cfg.xml”);
Here our configuration file name is your choice, but by default we have been given hibernate.cfg.xml, so once this configuration file is loaded in our java app, then we can say that hibernate environment is started in our program.
So once we write the line configurationObj.configure(“hibernate.cfg.xml”),
configuration object configurationObj will reads this xml file
hibernate.cfg.xml, actually internally configurationObj will uses DOM parsers to read the file.
About the job of configurationObj
configurationObj will reads data from hibernate.cfg.xml
Stores the data in different variables
All these variables are grouped and create one high level hibernate object we can call as
SessionFactory object.
So Configuration class only can create its SessionFactory object