This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Opening a session in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Opening a session in hibernate" Watch "Opening a session in hibernate" New topic
Author

Opening a session in hibernate

Arka Sharma
Ranch Hand

Joined: Jun 15, 2011
Posts: 103


Hi,

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.

Thanks,
Arka
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Opening a session in hibernate
 
Similar Threads
Hibernate session thread safety issue
Hibernate & Spring performance problem
Connecting to Multiple databases in hibernate
Multiple Schemas
glassfish vs. Hibernate: JNDI configuration