title: Not able to retrieve data of a single row in room database by selecting it
body: <p>Main Activity</p>
  
  <pre><code>myRoomDatabase3 = Room.databaseBuilder(getApplicationContext(),MyRoomDatabase.class,"messagedb3").fallbackToDestructiveMigration().allowMainThreadQueries().build();
  
  Message message4 = new Message();
              message4.setTime("14:10");
              message4.setContactName("Deepika");
              message4.setDate("02-12-2018");
              message4.setMsg("HI");
  
              MainActivity.myRoomDatabase3.myDao().addMessage(message4);
  
              Toast.makeText(MainActivity.this,"Message added",Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>My MyDao interface code:-</p>
  
  <pre><code>import android.arch.persistence.room.Dao;
  import android.arch.persistence.room.Insert;
  import android.arch.persistence.room.Query;
  
  @Dao
  public interface MyDao {
  
  @Insert
  public void addMessage(Message message);
  
  @Query("SELECT * FROM messages3 WHERE message_date LIKE :givenDate AND "  + "message_time LIKE :givenTime LIMIT 1")
  public Message getMessageInfo(String givenDate,String givenTime);
  </code></pre>
  
  <p>}</p>
  
  <p>My Message class :-</p>
  
  <pre><code>import android.arch.persistence.room.ColumnInfo;
  import android.arch.persistence.room.Entity;
  import android.arch.persistence.room.PrimaryKey;
  
  @Entity(tableName = "messages3")
  public class Message {
  
  @PrimaryKey(autoGenerate = true)
  private int id;
  
  @ColumnInfo(name = "message_date")
  private String date;
  
  @ColumnInfo(name = "message_time")
  private String time;
  
  @ColumnInfo(name = "message_contactName")
  private String contactName;
  
  @ColumnInfo(name = "message_msg")
  private String msg;
  
  public String getDate() {
      return date;
  }
  
  public void setDate(String date) {
      this.date = date;
  }
  
  public String getTime() {
      return time;
  }
  
  public void setTime(String time) {
      this.time = time;
  }
  
  public String getContactName() {
      return contactName;
  }
  
  public void setContactName(String contactName) {
      this.contactName = contactName;
  }
  
  public String getMsg() {
      return msg;
  }
  
  public void setMsg(String msg) {
      this.msg= msg;
  }
  
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Trying to retrieve data from one row of database whose Date and Time is as given:-</p>
  
  <pre><code>Calendar calender = Calendar.getInstance();
      calender.set(Calendar.YEAR,2018);
      calender.set(Calendar.MONTH, 11);
      calender.set(Calendar.DAY_OF_MONTH, 02);
      SimpleDateFormat simpledateformat = new SimpleDateFormat("dd-MM-yyyy");
      String Date = simpledateformat.format(calender.getTime());
  
      Calendar cal = Calendar.getInstance();
      cal.set(Calendar.HOUR_OF_DAY, 14);
      cal.set(Calendar.MINUTE, 10);
      cal.set(Calendar.SECOND,00);
      SimpleDateFormat simpletimeformat = new SimpleDateFormat("hh:mm");
      String Time = simpletimeformat.format(cal.getTime());
  
      Message message = MainActivity.myRoomDatabase3.myDao().getMessageInfo(Date,Time);
  
      String contactName = (message==null) ? "No data found" : message.getContactName();
      String text = (message == null) ? "No data found" : message.getMsg();
  </code></pre>
  
  <p>My Room Database class:-</p>
  
  <pre><code>import android.arch.persistence.room.Database;
  import android.arch.persistence.room.RoomDatabase;
  
  
  @Database(entities = {Message.class},version = 12,exportSchema = false)
  public abstract class MyRoomDatabase extends RoomDatabase {
  
  public abstract MyDao myDao();
  
  }
  </code></pre>
  
  <p>My build.gradle file:-</p>
  
  <pre><code>allprojects {
  repositories {
      google()
      jcenter()
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Dependencies- </p>
  
  <pre><code>dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:28.0.0'
  implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  
  implementation 'android.arch.persistence.room:runtime:1.0.0'
  annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
  }
  </code></pre>
  
  <p>How to remove error?What is wrong?How to read a single row of data by searching it from date and time field?</p>
  
  <p>I have added the entire code that I am using.Please please tell me something is wrong.I am stuck on this for 2-3 days.Something has to be wrong.What is it?
  Why query is returning null? </p>