title: Room Update not Updating Database
body: <p>I'm new to Room and am having some trouble updating the database. Insert and delete work as expected but the update does not. The data remains the same in the database. I've tried the update using the entire object and the specific field in an @Query statement. What am I doing wrong?</p>
  
  <p>Entity:</p>
  
  <pre><code>@Entity(tableName = "Appointments")
  public class Appointment {
  
  @PrimaryKey
  @NonNull
  public int AppointmentID;
  public Boolean CheckInStatus;
  
  public Appointment(
          @NonNull int AppointmentID,
          Boolean CheckInStatus
  ) {
  
      this.AppointmentID = AppointmentID;
      this.CheckInStatus = CheckInStatus;
  
  }
  
  public void setCheckInStatus(Boolean checkInStatus) {
      CheckInStatus = checkInStatus;
  }
  
  @NonNull
  public int getAppointmentID() {
      return this.AppointmentID;
  }
  
  public Boolean getCheckInStatus() {
      return CheckInStatus;
  }
  
  public void setID(@NonNull int AppointmentID) {
      this.AppointmentID = AppointmentID;
  }
  </code></pre>
  
  <p>Dao:</p>
  
  <pre><code>@Update
  void update(Appointment appointment);
  
  @Query("UPDATE Appointments SET CheckInStatus = 1 WHERE AppointmentID = :Id")
  void updateCheckIn(int Id);
  </code></pre>
  
  <p>Repo:</p>
  
  <pre><code>public void updateCheckIn(int Id) {
      new AppointmentRepository.updateCheckInAsyncTask(mAppointmentDao, Id);
  }
  
  public static class updateCheckInAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
      private AppointmentDao mAsyncTaskDao;
      private int mId;
  
      updateCheckInAsyncTask(AppointmentDao dao, int Id) {
  
          mAsyncTaskDao = dao;
          mId = Id;
      }
  
      @Override
      protected Void doInBackground(Void... voids) {
          mAsyncTaskDao.updateCheckIn(mId);
          return null;
      }
  }
  
  public void update(Appointment appointment) {
      new AppointmentRepository.updateAsyncTask(mAppointmentDao, appointment);
  }
  
  private static class updateAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
      private AppointmentDao mAsyncTaskDao;
      private Appointment mAppointment;
  
      updateAsyncTask(AppointmentDao dao, Appointment appointment) {
  
          mAsyncTaskDao = dao;
          mAppointment = appointment;
      }
  
      @Override
      protected Void doInBackground(Void... voids) {
          mAsyncTaskDao.update(mAppointment);
          return null;
      }
  }
  </code></pre>
  
  <p>View Model:</p>
  
  <pre><code>public void update(Appointment appointment) { mRepository.update(appointment); }
  
  public void updateCheckIn(int Id) { mRepository.updateCheckIn(Id); }
  </code></pre>
  
  <p>Activity:</p>
  
  <pre><code>// Update check in status in table
  mAppointmentVM.updateCheckIn(mId);
  </code></pre>
  
  <p>The correct id is being passed as was the updated object when I went that route. Any assistance is greatly appreciated.</p>
  
  <p>EDIT:
  The final answer is:</p>
  
  <pre><code>   public void updateCheckIn(int Id) {
      new AppointmentRepository.updateCheckInAsyncTask(mAppointmentDao, Id).execute();
  }
  
  public static class updateCheckInAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
      private AppointmentDao mAsyncTaskDao;
      private int mId;
  
      updateCheckInAsyncTask(AppointmentDao dao, int Id) {
  
          mAsyncTaskDao = dao;
          mId = Id;
      }
  
      @Override
      protected Void doInBackground(Void... voids) {
          Appointment entity = mAsyncTaskDao.getAppointmentDetails(mId);
          entity.setCheckInStatus(true);
          mAsyncTaskDao.update(entity);
          return null;
      }
  }
  </code></pre>