SessionFactory in hibernate are thread safe.
So it is recommended to have only copy of Sessionfactory.
Whereas Hibernate Session are not thread safe and Session can have many instances.
To achieve this use of Singleton by creating static instance of Sessionfactory and then create static method returning SessionFactory instace.
From novice to tech pro — start learning today.