# server

Łukasz Pięta

02/16/2023, 12:30 PM
Hi 👋 What do you think about making a JPA entity
data class
? I know that equals and hashcode need to be overridden then, but what about "The entity class must not be final*"* rule from JPA Specification? It can be easily solved by all-open compiler plugin as well. However it looks weird in the bytecode
Copy code
@javax.persistence.Entity public open data class
I already found an issue and the answer
data class
contracts will eventually bring more harm than good.
but I wonder what are the exact consequences of breaking the
data class

Jonas TM

02/16/2023, 1:06 PM
Have a look at this webinar from yesterday. It also covers data class and JPA

👍🏾 1
👍 1

Łukasz Pięta

02/17/2023, 9:33 AM
@Jonas TM Thanks for the link! However it wast just said "not to use
data class
for `@Entity`", but no further analysis was made 😕 I already knew that
data class
causes problems to the JPA and there is a more detailed video from jetbrains explaining that further

but still I don't know what might be the consequences of breaking the
data class
contract in bytecode, even though I know there is no sense to use
data class
for entity at all