public String deleteWithCompositePrimaryKey(String tableName, List<PrimaryKeyElement> primaryKeys) {

        StringBuffer sql = new StringBuffer();
        sql.append("delete from " + tableName + " where ");

        if (tabla.getSelectedRows().length == 1) {

            for (Iterator<PrimaryKeyElement> iterator = primaryKeys.iterator(); iterator.hasNext();) {
                PrimaryKeyElement pk = iterator.next();
                if (pk.requiredQuotes()) {
                    sql.append(pk.getNombre() + " = '" + tabla.getModel().getValueAt(tabla.getSelectedRows()[0], pk.getPosicion()) + "' ");
                }
                else {
                    sql.append(pk.getNombre() + " = " + tabla.getModel().getValueAt(tabla.getSelectedRows()[0], pk.getPosicion()));
                }

                if (iterator.hasNext()) {
                    sql.append(" AND ");
                }
            }

        }
        else {

            for (int i = 0; i < tabla.getSelectedRows().length; i++) {

                sql.append(" (");
                for (Iterator<PrimaryKeyElement> iterator = primaryKeys.iterator(); iterator.hasNext();) {
                    PrimaryKeyElement pk = iterator.next();

                    if (pk.requiredQuotes()) {
                        sql.append(pk.getNombre() + "='" + tabla.getModel().getValueAt(tabla.getSelectedRows()[i], pk.getPosicion()) + "'");
                    }
                    else {
                        sql.append(pk.getNombre() + "=" + tabla.getModel().getValueAt(tabla.getSelectedRows()[i], pk.getPosicion()));
                    }

                    if (iterator.hasNext()) {
                        sql.append(" AND ");
                    }
                }
                sql.append(") ");

                if (i < tabla.getSelectedRows().length - 1) {
                    sql.append(" OR ");
                }
            }
        }

        return sql.toString();
    }