I discovered JPA Buddy plugin for IntelliJ IDEA. In all my projects i love to use Lombok. It saves a lot of space in my entity classes. However, i just noticed, that JPA Buddy highliths it and suggest to replace.
As a result, the @Data annotation is replaced with:
@Getter
@Setter
@ToString
@RequiredArgsConstructor
- the hashCode and equals implementations were added:
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
return false;
}
Project project = (Project) o;
return id != null && Objects.equals(id, project.id);
}
@Override
public int hashCode() {
return getClass().hashCode();
}
I clearly see the desription: Using @Data for JPA entities is not recommended. It can cause severe performance and memory consumption issues
But can somebody provide some real world example? From my perspective, @Data includes everything i need (equals/hashcode) as well. And i didn't notice any performance issues in my projects.