Wrap row from multiple sub-queries
- Dominant language
- Kotlin
- Stars
- 9.3k
- Forks
- 798
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 26
Description
Hey!
I'm wondering how I can wrap a `ResultRow` back to an `Entity` when it's columns are within more than one `QueryAlias`.
Example table:
```kotlin
object Tests : UUIDTable() {
val something = varchar("something", 50)
}
class Test(id: EntityID) : UUIDEntity(id) {
companion object : UUIDEntityClass(Tests)
var something by Tests.something
}
```
Selecting from multiple sub queries:
```kotlin
val subQuery1 = Tests.selectAll().alias("sub_query_1")
val subQuery2 = subQuery1.selectAll().alias("sub_query_2")
subQuery2.selectAll().forEach { row ->
// to access just "something" I have to mention every sub-query in correct order to retain references
val something = row[subQuery2[subQuery1[Tests.something]]]
// but I can't do that with `wrapRow`, so this will throw an exception because the references are unclear
// IllegalArgumentException: QueryAlias doesn't have any column from tests table
val test = Test.wrapRow(row, subQuery2)
}
```
How can I get my `Test` entity back from these sub-queries?
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.