public void update(FriendshPk pk, Friendsh dto) throws FriendshDaoException {
	long t1 = System.currentTimeMillis();
	// declare variables
	final boolean isConnSupplied = (userConn != null);
	Connection conn = null;
	PreparedStatement stmt = null;

	try {
	    // get the user-specified connection or get a connection from the
	    // ResourceManager
	    conn = isConnSupplied ? userConn : ResourceManager.getConnection();

	    if (logger.isDebugEnabled()) {
		logger.debug("Executing " + SQL_UPDATE + " with DTO: " + dto);
	    }

	    stmt = conn.prepareStatement(SQL_UPDATE);
	    int index = 1;
	    if (dto.getIdFriendsh() != null) {
		stmt.setInt(index++, dto.getIdFriendsh().intValue());
	    } else {
		stmt.setNull(index++, java.sql.Types.INTEGER);
	    }

	    stmt.setString(index++, dto.getFriendFrom().getEmail());
	    stmt.setString(index++, dto.getFriendTo().getEmail());
	    stmt.setString(index++, dto.getStatusFriendsh().getFriendshStatus());
	    if (dto.getInvite().getIdInvite() != null) {
		stmt.setInt(index++, (dto.getInvite().getIdInvite()).intValue());
	    } else {
		stmt.setNull(index++, java.sql.Types.INTEGER);
	    }

	    stmt.setTimestamp(index++, dto.getFriendshDate() == null ? null
		    : new java.sql.Timestamp(dto.getFriendshDate().getTime()));
	    if (pk.getIdFriendsh() != null) {
		stmt.setInt(7, pk.getIdFriendsh().intValue());
	    } else {
		stmt.setNull(7, java.sql.Types.INTEGER);
	    }

	    int rows = stmt.executeUpdate();
	    reset(dto);
	    long t2 = System.currentTimeMillis();
	    if (logger.isDebugEnabled()) {
		logger.debug(rows + " rows affected (" + (t2 - t1) + " ms)");
	    }

	} catch (Exception _e) {
	    logger.error("Exception: " + _e.getMessage(), _e);
	    throw new FriendshDaoException("Exception: " + _e.getMessage(), _e);
	} finally {
	    ResourceManager.close(stmt);
	    if (!isConnSupplied) {
		ResourceManager.close(conn);
	    }

	}

    }