Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
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.