nilTheDev
10/22/2021, 6:37 PMJDBI
with Kotlin? I have been trying for several hours but couldn't even get a basic SELECT
statement working. Any assistance would be really helpful.
https://stackoverflow.com/questions/69681588/nosuchmethodexception-in-jdbi-while-using-it-with-kotlinShawn
10/22/2021, 6:48 PMjdbi3-kotlin-sqlobject
dependency you have in there is only a plugin—you need to have the base jdbi-core
dependency included as wellMarcus Brito
10/22/2021, 9:17 PMmapToBean
won’t really work with Kotlin data classesclass User {
var id: Int? = null
var name: String? = null
}
class User {
var id: Int = 0
var name: String = ""
}
jdbi3-kotlin
plugin and use .mapTo<User>
which is probably a better optionnilTheDev
10/23/2021, 3:48 AMMarcus Brito
10/25/2021, 1:24 PMmapToBean
method requires a no-args contructor, and accessor methods (get/set) for every property. Kotlin data classes, by default, won’t provide the no-arg constructor, nor set methods since they’re immutable. You can get those from regular Kotlin classes with var
properties.