JDBI supports proper mapping to Kotlin-classes via the jdbi3-kotlin plugin. The DaoOfAny class from jdbiorm only provides a Java-FieldMapper, this works to some extent with Kotlin.
The FieldMapper requires you to use default-values for all data-class properties, because the data class will be constructed using the default constructor () and filled afterwards. The KotlinMapper directly constructs the data class with the values provided (properties not present in the constructer will be filled afterwards).
Better and further description can be found here: https://github.com/jdbi/jdbi/tree/master/kotlin
Maybe vok-orm could provide/register the plugin and convenience-classes like:
open class KtDao<T : AbstractEntity<ID>, ID>(entityClass: Class<T>) : Dao<T, ID>(entityClass) {
override fun getRowMapper(): RowMapper<T> = KotlinMapper(entityClass) as RowMapper<T>
}
.
JDBI supports proper mapping to Kotlin-classes via the
jdbi3-kotlinplugin. The DaoOfAny class from jdbiorm only provides a Java-FieldMapper, this works to some extent with Kotlin.The
FieldMapperrequires you to use default-values for all data-class properties, because the data class will be constructed using the default constructor()and filled afterwards. The KotlinMapper directly constructs the data class with the values provided (properties not present in the constructer will be filled afterwards).Better and further description can be found here: https://github.com/jdbi/jdbi/tree/master/kotlin
Maybe vok-orm could provide/register the plugin and convenience-classes like:
.