private void close() throws PersistenceException { try { if (this.connection != null && !this.connection.isClosed()) { ConnectionProvider.getInstance().closeConnection(); this.connection = null; } } catch (SQLException sqlException) { throw new PersistenceException(sqlException); } }
public Connection getConnection() throws PersistenceException { try { if (this.connection == null || this.connection.isClosed()) { this.connection = ConnectionProvider.getInstance().getConnection(); } } catch (SQLException sqlException) { throw new PersistenceException(sqlException); } return this.connection; }