Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session management using Hibernate in a Swing application

Tags:

People also ask

What is session management in Hibernate?

A Session is used to get a physical connection with a database. The Session object is lightweight and designed to be instantiated each time an interaction is needed with the database. Persistent objects are saved and retrieved through a Session object.

Can Hibernate session be shared between threads?

If you were sharing a Hibernate Session between two threads, then one thread changes might not be visible to some other thread (without proper synchronization or volatile reads).


How do you do your Hibernate session management in a Java Desktop Swing application? Do you use a single session? Multiple sessions?

Here are a few references on the subject:

  • http://www.hibernate.org/333.html
  • http://blog.schauderhaft.de/2008/09/28/hibernate-sessions-in-two-tier-rich-client-applications/
  • http://in.relation.to/Bloggers/HibernateAndSwingDemoApp