In the package org. Hibernate, SessionFactory is used to build Session Object. I.e., factory, Session object is constructed based on SessionFactory thing.
It is thread-safe and immutable by nature.
Hibernate Framework is used to establish a connection/session with database software. It is used to conduct CRUD operations on the database.
a session is created by calling factory.buildSession()
To establish a physical database connection, you must first establish a session. The Session object is designed to be lightweight and instantiated when a database interaction is required. Using a Session object, persistent objects are saved and retrieved.
Because session objects are not thread-safe, they should be generated and discarded as needed. Session instances can be created, read, and deleted.
At any given moment, instances may be in one of the following three states: