title: how to convert kotlin Exposed ResultSet to Entity?
body: <p>I use kotlin Exposed with DAO style, and have a code like below. here, Nodes is Table of Exposed and Node is Entity which is created from Nodes table, and has Long Id.</p>
  <pre><code>    transaction {
          TransactionManager.current().exec(
              &quot;select * from nodes &quot; + 
              &quot;where date_part('microseconds', updated_at - last_deployed) &gt; 1000 &quot; + 
              &quot;order by last_change_status asc &quot; + 
              &quot;limit &quot; + max + &quot; offset &quot; + offset
          ) { 
              rs -&gt; while (rs.next()) {
                  // Question: how I can convert rs to Node object correctly???
                  nodes.add(Node.wrap(EntityID(rs.getLong(&quot;id&quot;), Nodes), ResultRow.create(rs, Nodes.columns)))
              }
          }
  </code></pre>
  <p>because Kotlin does not seem to be able to handle microseconds timestamp assignment correctly (it seems to be rounded in milli-seconds precision), I have to use raw SQL to ignore sub-milli-seconds difference.</p>
  <p>I can get ResultSet correctly, but need to convert ResultSet to target Entity to use the result in different part of code.</p>
  <pre><code>nodes.add(Node.wrap(EntityID(rs.getLong(&quot;id&quot;), Nodes), ResultRow.create(rs, Nodes.columns)))
  </code></pre>
  <p>passes compile, but when I actually access property (eg. podName) of Node object, it raises following exception. note that if I use regular way to select Entity like <code>nodes = Node.find{ Nodes.lastDeployed less Nodes.updateAt }.limit(max, offset).asSequence().toList()</code>, the error has gone.</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
      at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
      at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
  Caused by: java.lang.IllegalStateException: No transaction in context.
      at org.jetbrains.exposed.sql.transactions.TransactionManager$Companion.current(TransactionApi.kt:98)
      at org.jetbrains.exposed.sql.Query.getTransaction(Query.kt:16)
      at org.jetbrains.exposed.sql.Query.iterator(Query.kt:214)
      at kotlin.collections.CollectionsKt___CollectionsKt.firstOrNull(_Collections.kt:231)
      at org.jetbrains.exposed.dao.Entity.getReadValues(Entity.kt:25)
      at org.jetbrains.exposed.dao.Entity.lookup(Entity.kt:107)
      at org.jetbrains.exposed.dao.Entity.getValue(Entity.kt:88)
      at com.mydomain.models.Node.getPodName(Node.kt)
  </code></pre>
  <p>Node object created by <code>Node.wrap(EntityID(rs.getLong(&quot;id&quot;), Nodes), ResultRow.create(rs, Nodes.columns))</code> seems to be in inconsistent state and treated as not fresh (I guess that is the reason Exposed try to access database again)...</p>
  <p>anyone have an same experience (convert raw SQL result to list of Exposed Entity)?</p>
  <p>regards,</p>