title: Exactly ONE TO ONE Relation in Room
body: <p>I believe it have been asked several times but no working solution.</p>
  
  <p>Room has <code>@Relation</code> annotation which is used for one to many relationships. That's basically if you have <code>User</code> and <code>Pet</code> models, as <code>User</code> can have several <code>Pet</code>s, <code>@Relation</code> annotation works perfectly as return type of <code>Pet</code>s are list (or set). </p>
  
  <pre><code>class UserAndAllPets : User() {
     @Relation(parentColumn = "id", entityColumn = "userId")
     var pets: List&lt;Pet&gt; = arrayListOf()
   }
  </code></pre>
  
  <p>The problem is what if in my case <code>User</code> and <code>Pet</code> is one to one related. As in every user can have one pet. That means there is no point of using <code>@Relation</code> as it only supports list or set return types. And it's totally inefficient to use as a list, even if I use it. So I am looking for a exact one to one relation where I can get a result of</p>
  
  <pre><code>class UserAndPet {
      var user: User? = null
      var pet: Pet? = null
  }
  </code></pre>
  
  <p>I have tried tried several was as well as <a href="https://stackoverflow.com/a/45327253/8412192">this</a> method (which has lots of upvotes, but it doesn't work). 
  Supposedly, </p>
  
  <pre><code>class UserAndPet {
      @Embedded
      var user: User? = null
      @Embedded
      var pet: Pet? = null
  }
  </code></pre>
  
  <p>Should work, but I am getting </p>
  
  <blockquote>
    <p>Not sure how to convert a Cursor to this method's return type (UserAndPet)</p>
  </blockquote>
  
  <p>There is no conflict as I already use <code>prefix</code> for <code>@Embedded</code> fields.</p>
  
  <p>And please, can you not redirect my to any other post on stack overflow, as I tried all but no luck.</p>
  
  <p>Thanks</p>