title: Update @PrimaryKey value in Android Room
body: <p>I want to update a bookmark, consisting of an url and a title, with the url as the primary key. Updating the title works flawlessly, but when I try to update the url, it doesn't work.</p>
  <pre><code>@Entity
  public class Bookmark {
  
      @PrimaryKey
      @NonNull
      private String url;
  
      private String title;
  
      ...
  }
  </code></pre>
  <pre><code>@Dao
  public interface BookmarkDao {
      ...
  
      @Update
      int update(Bookmark bookmark);
  
      ...
  }
  </code></pre>
  <pre><code>bookmark.setTitle(title);
  bookmark.setUrl(url);
  bookmarkDao.update(bookmark);
  </code></pre>
  <p>The problem is, when overwriting the old url with setUrl, the @Update int update(Bookmark bookmark) method has no way of knowing which row to change.</p>
  <p>My question is, is there some other possibility to update a primary key field by using @Update, or should I use @Query like this?</p>
  <pre><code>@Query(&quot;UPDATE Bookmark SET url = :url, title = :title WHERE url = :oldUrl&quot;)
  int update(String oldUrl, String url, String title);
  </code></pre>
  <p>Thanks in advance.</p>