gbaldeck
02/21/2020, 9:45 PMalex
02/23/2020, 8:32 PMdata class
, use class
instead (generated equals/hashCode are not really suitable for JPA, it's always the best to define them yourself)
• id must be nullable as well as var
, also you can make it a class property, rather than constructor parameter (there is no point in making it class-level parameter)gbaldeck
02/24/2020, 9:35 PMalex
02/24/2020, 9:49 PM@Id
annotation (and few others, like @CreatedBy
), is managed by end user, so this decision is all yours.
If data definitely immutable, then you can use `val`(which is a rare case, if you think about it), otherwise var
.