Hi! What is the best practice of using `data class...
# spring
a
Hi! What is the best practice of using
data class
as
Entity
?
t
don't, just read czar tutorial (official spring boot kotlin tutorial) a couple of posts above
👍 1
c
data classes are not very suitable for JPA Entities (I'm inferring JPA here, since you haven't specified that). E.g. see here: https://kotlinexpertise.com/hibernate-with-kotlin-spring-boot/ If you know what
data class
does and then read this guide, you'll see how data classes are not the best idea for entities.
👍 1
a
yeap, so i'm considering to move all entities to regular class
s
Regular classes with
var
properties,
val
is not a good fit with JPA sadly.
a
looks like we still need to use Lombok 😞
t
Use jooq instead of JPA, and avoid most issues. Sure you have to write queries, but if some performance problem comes up, it's more easy to understand and debug, and it's also more easy to understand than knowing everything hibernate does under the hood, which eventually you will have to know if the project is long enough.