title: Android Room - RawQuery not working to update/insert data in the DB
body: <p>I am using room library version 1.1.1 for database operation. I succeeded to create a table in the room but not able to insert/update data in it. Cursor giving me 0 value after performing the raw query but I can not see data in the DB. </p>
  
  <p>While executing the code room even not giving me an exception but when I perform simple insert query, it's working fine.</p>
  
  <p>The query simply says if we have <strong>chatDialogId</strong> in the <strong>Notifications</strong> table then update the message count or if it is not available just add a new raw with message count 1.   </p>
  
  <p>Thanks in advance</p>
  
  <p><strong>Entity Class</strong></p>
  
  <pre><code>@Entity(tableName = "Notifications")
  public class Notifications {
  
      @PrimaryKey(autoGenerate = true)
      @ColumnInfo(name = "id")
      private long id;
  
      @ColumnInfo(name = "chatDialogId")
      private String chatDialogId;
  
  
      @ColumnInfo(name = "messageCount")
      private int messageCount;
  
      public Notifications() {
      }
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public String getChatDialogId() {
          return chatDialogId;
      }
  
      public void setChatDialogId(String chatDialogId) {
          this.chatDialogId = chatDialogId;
      }
  
  
      public int getMessageCount() {
          return messageCount;
      }
  
      public void setMessageCount(int messageCount) {
          this.messageCount = messageCount;
      }
  
  }
  </code></pre>
  
  <p><strong>Dao</strong> </p>
  
  <pre><code>@Dao
  public interface SMDatabaseDao {
  
      @RawQuery
      public long insertUpdateNotificationCount(SupportSQLiteQuery query);
  }
  </code></pre>
  
  <p>Calling below method from <strong>FCMIntentService</strong> while received a message.</p>
  
  <pre><code>public Long insertUpdateNotificationCount(final String id) {
      return runInTransaction(new Callable&lt;Long&gt;() {
          @Override
          public Long call() throws Exception {
              String customQuery = "UPDATE Notifications SET messageCount=messageCount+1 WHERE chatDialogId='" + id + "' AND EXISTS ( SELECT 1 FROM Notifications WHERE chatDialogId='" + id + "'); " +
                      "INSERT into Notifications(chatDialogId,messageCount) SELECT '" + id + "', 1 WHERE not EXISTS ( SELECT 1 FROM Notifications WHERE chatDialogId='" + id + "');";
  
              return smDatabaseDao().insertUpdateNotificationCount(new SimpleSQLiteQuery(customQuery));
  
  
          }
      });
  }
  </code></pre>