--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/CAPv0rXGQb%3D-vMcn6KuSisUbXC3jjeUAfH%3D4E8jgJ6NvLO-FWLA%40mail.gmail.com.
Hi Lukas,
Thank you very much for your reply!! I think I owe you an apology. As usual, I oversimplified my example too much at the last minute—specifically the query: you need to load more than one column from the database. So either select(TEST.ID, TEST.CD)... or selectFrom(TEST)....
I assume there is some kind of shortcut when loading only a single column? With more than one column, the data class of course doesn’t match 100%, but that is exactly our case as well. In this situation, jOOQ even indicates that you should include kotlin-reflect, so that is indeed required.
I was then also able to reproduce the exception in the MCVE, specifically with Kotlin 2.3.20, but not with Kotlin 2.3.0. Here is a (complete) diff—don’t forget to update the Kotlin version in two places (plugin and reflect) when testing :-) I hope this works now! ;-)
Best regards,
Julian
diff --git a/jOOQ-mcve-kotlin-h2/build.gradle.kts b/jOOQ-mcve-kotlin-h2/build.gradle.kts
index 61ec3b1..c48daf8 100644
--- a/jOOQ-mcve-kotlin-h2/build.gradle.kts
+++ b/jOOQ-mcve-kotlin-h2/build.gradle.kts
@@ -2,18 +2,19 @@ import org.jooq.impl.DSL
import org.jooq.meta.jaxb.Logging
plugins {
- kotlin("jvm") version "1.9.22"
+ kotlin("jvm") version "2.3.20"
id("org.jooq.jooq-codegen-gradle") version "3.21.2"
}
// TODO: Change the database driver configuration here and also in AbstractTest for the tests
-val dbUrl = "jdbc:h2:~/jooq-mcve-java-2"
+val dbUrl = "jdbc:h2:~/jooq-mcve-kotlin-2"
val dbUsername = "sa"
val dbPassword = ""
dependencies {
jooqCodegen("com.h2database:h2:2.2.224")
implementation("${group}:jooq:${version}")
+ implementation("org.jetbrains.kotlin:kotlin-reflect:2.3.20")
implementation("com.h2database:h2:2.2.224")
testImplementation("junit:junit:4.13.2")
}
@@ -76,4 +77,4 @@ tasks.named("compileKotlin") {
tasks.named("jooqCodegen") {
dependsOn(tasks.named("init"))
-}
\ No newline at end of file
+}
diff --git a/jOOQ-mcve-kotlin-h2/src/test/kotlin/org/jooq/mcve/test/kotlin/h2/KotlinTest.kt b/jOOQ-mcve-kotlin-h2/src/test/kotlin/org/jooq/mcve/test/kotlin/h2/KotlinTest.kt
index 5309711..2dd1181 100644
--- a/jOOQ-mcve-kotlin-h2/src/test/kotlin/org/jooq/mcve/test/kotlin/h2/KotlinTest.kt
+++ b/jOOQ-mcve-kotlin-h2/src/test/kotlin/org/jooq/mcve/test/kotlin/h2/KotlinTest.kt
@@ -42,5 +42,9 @@ class KotlinTest {
val record = ctx().fetchOne(TEST, TEST.CD.eq(42))
assertNotNull(record?.id)
+
+ ctx().selectFrom(TEST).fetchInto(SimpleIntTest::class.java)
}
-}
\ No newline at end of file
+}
+
+data class SimpleIntTest(val id: Int)
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/63441cee-bed0-452c-8eb0-0fb40e83d711n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/gU3fbSNrk_s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO6_Ae4fj%3Da_0pfchBwgsBudP8DRof0oNwMNhzxthc_KGg%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/CAPv0rXGN7%3DaDUru69D6tJeENOot3yFBLUypcRf0%3DqQwSQHtE4Q%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO5hkkyZj9fWZagOgW%3DcmGffHa-KyKBUfVaD0udRhwg1XA%40mail.gmail.com.
To view this discussion visit https://groups.google.com/d/msgid/jooq-user/CAPv0rXFPh5fW2fr5vWNaxEfE8WOT3yuf%3D2atfhdUUeQ4OOhE2A%40mail.gmail.com.