Hello, I am a big fan of Spring, but an even bigge...
# spring
a
Hello, I am a big fan of Spring, but an even bigger fan of Kotlin Multiplatform, especially the common code part. However, for entities and persistence this is not possible, since the annotations are JVM-world only. What would be an optimal way to share the entities between platforms? One way would be to just accept it and write
fromDataEntity
and
toDataEntity
helper functions for every common data class which is to be persisted. But that is a lot of boilerplate I suppose. Any other ideas?
r
You can use `expect`/`actual` for annotations in common code.
a
Great! This is exactly what I need
r
Note there are some minor issues with this apprach (e.g. default values in
Table
annotation don't work - you need to use e.g.
@Table("articles", "articles", "")
)
a
Yeah, that makes sense. However I always prefer to be explicit with table naming anyway.