@Test public void testCloseDBConnection() throws SQLException { Session initialSession = connection.getSession(); connection.closeDBConnection(); Session newSession = connection.getSession(); assertNotEquals("New Session expected",initialSession, newSession); }
@Override public void closeDBConnection() throws SQLException { if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) { sessionFactory.getCurrentSession().close(); } }
HibernateDBConnection implements DBConnection<Session> { @Override public void closeDBConnection() throws SQLException { if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) { sessionFactory.getCurrentSession().close(); } } }
HibernateDBConnection implements DBConnection<Session> { @Override public void closeDBConnection() throws SQLException { if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) { sessionFactory.getCurrentSession().close(); } }  }
HibernateDBConnection implements DBConnection<Session> { @Override public void closeDBConnection() throws SQLException { if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) { sessionFactory.getCurrentSession().close(); } }  @Override Session getSession(); @Override boolean isTransActionAlive(); @Override boolean isSessionAlive(); @Override void rollback(); @Override void closeDBConnection(); @Override void commit(); @Override synchronized void shutdown(); @Override String getType(); @Override DataSource getDataSource(); @Override DatabaseConfigVO getDatabaseConfig(); @Override long getCacheSize(); @Override @SuppressWarnings("unchecked") E reloadEntity(final E entity); @Override void setConnectionMode(final boolean batchOptimized, final boolean readOnlyOptimized); @Override boolean isOptimizedForBatchProcessing(); @Override void uncacheEntity(E entity); }
HibernateDBConnection implements DBConnection<Session> { @Override public void closeDBConnection() throws SQLException { if (sessionFactory.getCurrentSession() != null && sessionFactory.getCurrentSession().isOpen()) { sessionFactory.getCurrentSession().close(); } }  @Override Session getSession(); @Override boolean isTransActionAlive(); @Override boolean isSessionAlive(); @Override void rollback(); @Override void closeDBConnection(); @Override void commit(); @Override synchronized void shutdown(); @Override String getType(); @Override DataSource getDataSource(); @Override DatabaseConfigVO getDatabaseConfig(); @Override long getCacheSize(); @Override @SuppressWarnings("unchecked") E reloadEntity(final E entity); @Override void setConnectionMode(final boolean batchOptimized, final boolean readOnlyOptimized); @Override boolean isOptimizedForBatchProcessing(); @Override void uncacheEntity(E entity);  }