title: kotlin exposed select with foreign key
body: <p>I have two tables like as I described below</p>
  <pre><code>object Categories : LongIdTable() {
      val name = varchar(name = &quot;name&quot;, length = 50).uniqueIndex()
      val count = integer(name = &quot;count&quot;)
      val page = integer(name = &quot;page&quot;)
  }
  
  object Images : LongIdTable() {
      val color = varchar(name = &quot;color&quot;, length = 100)
      val blurHash = varchar(name = &quot;blurHash&quot;, length = 200)
      val unsplashId = varchar(name = &quot;unsplashId&quot;, length = 200)
      val category = reference(name = &quot;category&quot;, Categories.name).nullable()
      val isAvailable = bool(name = &quot;isAvailable&quot;)
      val imagePath = varchar(name = &quot;imagePath&quot;, length = 500)
  }
  </code></pre>
  <p>and here is my <code>Image</code> &amp; <code>Category</code> data classes</p>
  <pre><code>@Serializable
  data class Image(
      val id: Long,
      val unsplashId: String,
      val isAvailable: Boolean = false,
      val color: String,
      val blurHash: String,
      var category: Category?,
      val imagePath: String,
  )
  
  @Serializable
  data class Category(
      val id: Long,
      val name: String,
      val count: Int,
      var imagePath: String?,
      val page: Int
  )
  </code></pre>
  <p>when I want to find images by their id I can't map category attribute</p>
  <pre><code> fun getImageById(id: Long): Image {
      val images = ArrayList&lt;Image&gt;()
      var categoryName = &quot;&quot;
      transaction {
          Images.select {
              Images.id eq id
          }.map { row -&gt;
              categoryName = row[Images.category]!!
              images.add(
                  Image(
                      id = row[Images.id].value,
                      unsplashId = row[Images.unsplashId],
                      isAvailable = false,
                      color = row[Images.color],
                      blurHash = row[Images.blurHash],
                      category = null,
                      imagePath = row[Images.imagePath]
                  )
              )
          }
          images[0].category = categoryRepository.getCategoryByName(categoryName)
      }
      return images[0]
  }
  </code></pre>
  <p>how can I solve this priblem?</p>