Suppose I have a model for data classes which I'm ...
# announcements
c
Suppose I have a model for data classes which I'm planning to persist using JPA. In Java I'm used to creating a BaseEntity with id, isNew, created, updated etc. and having the rest of the model extend it. In Kotlin I instinctively try to do the same and model being data classes by nature I also instinctively put
data
modifier on the classes. But no such luck, although data classes can extend other classes, unfortunately they cannot have non val/var constructor parameters, so I cannot extend my BaseEntity. And this restriction screws up my code all over the place, I just can't use data classes in places where they actually make sense. What is the point of data classes if you cannot create meaningful hierarchies using them?