Reputation: 2489
I imported a project that use lombok to decrease code, but I got error "The method getBooks() is undefined for the type Author", where Book and Author are two entities.
this.getBooks().add(book);
book.setAuthor(this);
The Book Class used such anootations, and I also got warning "The type Builder is deprecated", how can I solve this problems?
@Entity
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(exclude = "id")
@ApiObject(name = "Book", group = DocumentationConstants.GROUP_LIBRARY, description = "Represents a book. Every book has an <code>Author</code> and a price.")
public class Book {
...
}
Upvotes: 1
Views: 918
Reputation: 34462
I don't know about the problem regarding getBooks, but to solve the deprecation warning, you probably should replace the import from lombok.experimental.Builder
to lombok.Builder
Disclosure: I am a Lombok developer.
Upvotes: 1