/** * Execute the command that's defined by the subclass following * the Command pattern. Specialized parameters are held in the command instances. * * @return ResultSet from executing a query * @throws SQLException if a database error occurs */ protected final ResultSet execute() throws SQLException { connection = createConnection(); setInternalConnection(connection); statement = null; try { // The variation in the pattern is isolated ResultSet result = runQuery(connection); assert (null != statement); return result; } catch (SQLException e) { LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); closeResources(); connection = null; statement = null; throw e; } }
/** * Execute the command that's defined by the subclass following * the Command pattern. Specialized parameters are held in the command instances. * * @return ResultSet from executing a query * @throws SQLException if a database error occurs */ protected final ResultSet execute() throws SQLException { connection = createConnection(); setInternalConnection(connection); statement = null; try { // The variation in the pattern is isolated ResultSet result = runQuery(connection); assert (null != statement); return result; } catch (SQLException e) { LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); closeResources(); connection = null; statement = null; throw e; } }
/** * Execute the command that's defined by the subclass following * the Command pattern. Specialized parameters are held in the command instances. * * @return ResultSet from executing a query * @throws SQLException if a database error occurs */ protected final ResultSet execute() throws SQLException { connection = createConnection(); setInternalConnection(connection); statement = null; try { // The variation in the pattern is isolated ResultSet result = runQuery(connection); assert (null != statement); return result; } catch (SQLException e) { LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage()); closeResources(); connection = null; statement = null; throw e; } }
/** * Execute the command that's defined by the subclass following * the Command pattern. Specialized parameters are held in the command instances. * * @return ResultSet from executing a query * @throws SQLException if a database error occurs */ final ResultSet execute() throws SQLException { connection = createConnection(); setInternalConnection(connection); statement = null; try { log.fine(sql); // The variation in the pattern is isolated ResultSet result = runQuery(connection); assert (null != statement); return result; } catch (SQLException e) { log.log(Level.FINE, "Failed to execute: " + sql, e); closeResources(); connection = null; statement = null; throw e; } }