Exemplo n.º 1
0
 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);
   }
 }
Exemplo n.º 2
0
 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;
 }