Hello all. Fairly new to Kotlin, but loving it so ...
# announcements
g
Hello all. Fairly new to Kotlin, but loving it so far. One area that is causing some consternation is that of JPA/Hibernate and the correct way to do it in Kotlin. All the blogs and articles that I’ve read on the subject appear to contradict each other with regards to whether to use data classes or not; what to put in the constructor; should properties be val or var. Can anyone point me in the direction of a clear and unambiguous example of how JPA/Hibernate entities should be defined in Kotlin? I’m look for the best practice.
m
you could try asking in #jpa and #hibernate
t
there is also a #spring (which is active, not like the other two). https://spring.io/guides/tutorials/spring-boot-kotlin/ there is a chapter on jpa, bottom line don't use data classes (https://vladmihalcea.com/the-best-way-to-implement-equals-hashcode-and-tostring-with-jpa-and-hibernate/) and don't use immutability. jpa does not cope well with immutability (though most people don't have problems there)