How to create Hibernate's SessionFactory?
When creating an application the use Hibernate to manage our application persistence object we'll need a
SessionFactory. This factory creates or open a session to talk to a database.
To create a
SessionFactory we can define the configuration in
hibernate.cfg.xml or create it programatically. In this example we'll use the
hibernate.cfg.xml configuration file, which is mostly use when creating Hibernate application.
Below is our session configuration files.
Now we have the configuration file done, let's create a helper class that will configure and build the
SessionFactory object. This helper will be used in other Hibernate example in this site.