public void update(Dictionary d) throws DAOException { try { // Create the statement with the SQL query PreparedStatement pState = connection.prepareStatement(REQUEST_UPDATE); pState.setString(1, d.getValue()); pState.setInt(2, d.getFk()); pState.setInt(3, d.getType().getValue()); pState.setString(4, d.getLang()); if (log.isDebugEnabled()) { log.debug(pState.toString()); } // Execute the SQL statement pState.execute(); // Close the statement pState.close(); } catch (SQLException e) { throw new DAOException("SQLException : " + e.getMessage()); } }
public void add(Dictionary d) throws DAOException { try { // Create the statement with the SQL query PreparedStatement pState = connection.prepareStatement(REQUEST_INSERT); // Put the parameters in the prepared statement pState.setInt(1, d.getFk()); pState.setInt(2, d.getType().getValue()); pState.setString(3, d.getLang()); pState.setString(4, d.getValue()); if (log.isDebugEnabled()) { log.debug("Query : " + pState); } // Execute the SQL statement pState.execute(); // Close the statement pState.close(); } catch (SQLException e) { throw new DAOException("SQLException : " + e.getMessage()); } }