Spring Boot 3 - ep9 Part 2 : Troubleshooting Lombok stackoverflow No default constructor for entity

preview_player
Показать описание
Trouble shooting | Lombok StackOverFlow | No default constructor for entity
@JSONIgnore

We have some errors in this one.

scary :o ?
not really... Like I said in a previous video #lombok is great but you need to know how to use it. We learn from errors the red is good remember.

The two errors we are dealing with on this one

Error : No default constructor for entity

Lombok-generated constructors conflict with JPA (Java Persistence API) requirements.

The @Data annotation from Lombok generates various methods for your class, including getters, setters, equals(), hashCode(), and a default constructor. However, when working with JPA, entity classes require a default constructor explicitly defined in the class, even if it's empty. This is because JPA implementations use reflection to instantiate entity objects.

Lombok Stackoverflow
Circular references: Lombok annotations can create circular
references if you have bidirectional relationships between your entities or classes.
For example, if you have two entities that reference each other using Lombok's @ToString annotation,
it can cause an infinite loop and result in a StackOverflowError.

#java #programming #springboot #coding #error #stackoverflow #learntocode #learnprogramming
Рекомендации по теме
welcome to shbcf.ru