title: Hibernate check connection to database in Thread ( every time period )
body: <p>What is best/good/optimal way to monitor connection to database. 
  Im writing swing application. What I want it to do is to check connection with database every time period. I've tried something like this.</p>
  
  <pre><code>org.hibernate.Session session = null;
              try {
                  System.out.println("Check seesion!");
                  session = HibernateUtil.getSessionFactory().openSession();
  
              } catch (HibernateException ex) {
              } finally {
                  session.close();
              }
  </code></pre>
  
  <p>But that dosn't work. 
  Second question which is comming to my mind is how this session closing will affect other queries.</p>