title: How to query nested Embeded objects using Room Persistance Library in android?
body: <p>Consider I have 3 classes User, Address, Location </p>
  
  <pre><code>class Address {
      public String street;
      public String state;
      public String city;
  
      @ColumnInfo(name = "post_code")
      public int postCode;
  
      @Embedded(prefix = "home_")
      public Location homeLocation;
  
      @Embedded(prefix = "office_")
      public Location officeLocation;
  }
  
  class Location{
       public long lat;
       public long lng;
  }
  
  @Entity
  class User {
      @PrimaryKey
      public int id;
  
      public String firstName;
  
      @Embedded(prefix = "addr_")
      public Address address;
  }
  </code></pre>
  
  <p>How should i write the query to get the users whose home location is between certain latitude and longitude boundary ? </p>
  
  <p>Ex: If i want to find all users whose home location is between these two points Location1(13.135795,77.360348) &amp; Location2(12.743639, 77.901424).
  My query would look something like this -</p>
  
  <blockquote>
    <p>select * from User where address.homelocation.lat &lt; :l1_latitude &amp;&amp;  address.homelocation.lat > l2_latitude &amp;&amp; address.homelocation.lng > :l1_longitude &amp;&amp; address.homelocation.lng &lt; :l2_longitude</p>
  </blockquote>
  
  <p>If i have to use prefix in the embedded location from my understanding, correct me if am wrong, all the fields inside address will get appended with prefix. So i can query city as addr_city and if i have to query lat inside the homeLocation then will it become addr_home_lat ?</p>
  
  <p>Is nested embedded objects permitted in room database? If yes then how do i query the nested embedded objects? </p>
  
  <p>Need some help here. Thank you. </p>