79596092

Date: 2025-04-28 09:00:05
Score: 1.5
Natty:
Report link

I believe the culprit here is not Hibernate but Lombok, lombok @Data annotation, which generates an unnecessary toString() and @EqualsAndHashCode and these methods use relational data. To resolve this, I suggest removing the @Data annotation and instead using the @Getter, @Setter, @NoArgsConstructor, @AllArgsConstructor and @EqualsAndHashCode(onlyExplicitlyIncluded = true) annotations. Alternatively, you could completely ditch using Lombok and rely on ide-generated getters and setters instead.

If you only want to update one field, use the update query directly. The save method in Spring Data JPA functions both as an update and a persist, which can sometimes lead to unexpected behavior.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • User mentioned (1): @Data
  • User mentioned (0): @EqualsAndHashCode
  • User mentioned (0): @Data
  • User mentioned (0): @Getter
  • User mentioned (0): @Setter
  • User mentioned (0): @NoArgsConstructor
  • User mentioned (0): @AllArgsConstructor
  • Low reputation (0.5):
Posted by: kush parsaniya