Why use only one SessionFactory Object per application? What are the advantages of using single session factory object per application?
Ya, Its very simple to understand that sessionFactory follow singleton design pattern. So you can create only one object in hole application. SessionFactory is also thread safe so only one thread can execute at a time its code. The instance of sessionFactory is heavyweighted because it contains connection, hibernate configuration, mapping files, location path so if you create number of instance of sessionFactory then your code becomes very heavy. Due to that reason we are using only one sessionFactory instance for one application. To improve performance of our application we are using only one instance of sessionFactory in one application.