Closed Metis-Adrastea closed 2 years ago
Hi @Metis-Adrastea , thanks a lot for the feedback !!
You have to declare a value for the composite primary key :
object Users : PostgresqlTable<User>("users") {
val name = text(User::name)
val age = integer(User::age)
val pk = primaryKey(name, age)
}
I will add this example to the Kotysa table mapping doc
Hi @pull-vert! Thanks for the quick response, but this option doesn't work either. The same error occurs.
Exception in thread "main" java.lang.ExceptionInInitializerError
at MainKt.main(Main.kt:25)
at MainKt.main(Main.kt)
Caused by: java.lang.ClassCastException: [Lorg.ufoss.kotysa.Column; cannot be cast to [Lorg.ufoss.kotysa.DbColumn;
at Users.<clinit>(Main.kt:13)
... 2 more
@Metis-Adrastea thanks again for submitting this issue, and providing a reproduction repository.
I just released Kotysa 2.1.2 with that Fix, it should be on Maven Central now (or very soon)
Thanks also for the init
nice syntax for composite primary key, more elegant than my unused value declaration ! :slightly_smiling_face:
@pull-vert Thanks a lot, very cool!
java.lang.ClassCastException on composite primary key with different column types. Full example https://github.com/Metis-Adrastea/kotysa-composite-pk