title: Room: query with subquery. How to model the dataclasses?
body: <p>I would like to perform a query on a room database that results in a list of records, which are composed of columns from several tables. First I have a subquery which is then joined with another table. In the result I select only a few columns. In this query I use 3 tables.</p>
  
  <p>When I compile the project I get the error saying:</p>
  
  <p><strong>Cannot figure out how to read this field from a cursor. private org.joda.time.DateTime createdDate;</strong>.</p>
  
  <p>The error points to this DateTime field.</p>
  
  <p>Here is my interface:</p>
  
  <pre><code>@Dao
  interface SomeObjectDao {
    @Query (
      SELECT a.Id, a.number, b.CreatedDate as createdDate
      FROM (SELECT p.*, q.*
            FROM tableP AS p, tableQ AS q
            WHERE p.userId = q.userId) AS a, table2 AS b
      WHERE a.Id = b.someId AND a.position = b.position)
    fun getSummary(): List&lt;SomeObjectSummaryDB&gt;
  }
  </code></pre>
  
  <p>and my custom class for the SomeObjectSummaryDB looks like this:</p>
  
  <pre><code>class SomeObjectSummaryDB(
    var Id: String,
    var number: Int,
  
    @TypeConverters(DateTimeConverter::class)
    var createdDate: DateTime
  )
  </code></pre>
  
  <p>I have seen some examples showing the use of the @Embedded and @ForeignKey annotations. Is this something I need in this case? If so, can anyone help me what is needed to get my list of objects?</p>
  
  <p>Do I need to make a model for both the subquery and the overall result?
  If so, how would these models look like?</p>
  
  <p>Any help is greatly appreciated!</p>