Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Opening a session in hibernate  RSS feed

Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I am working with hibernate to connect to HSQL. I have created a static session factory and using it in all the methods where I need to connect to HSQL. But in those each time I'm creating a new session object by calling SessionFactory.openSession(). Now if I create a static session reference and reuse it in deifferent methods to neglect sssion open and close calls for each method will it add any performance improvement ? Which one is more time consuming creating a session factory or opening and closing a session.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!