Lombok dependency added but @Getter, @Setter not working for classes

63 Views Asked by At

I copied my project from one laptop to another. Lombok dependency is already added in its pom.xml file. But now, the java classes in my project using @getter, @setter are not are not able to generate get..() and set..() functions when their objects are created and hence build is failing.

Example:

User class

@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name="posts")
public class Post {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer postId;


@Column(name="post_title", length=100, nullable=false)
private String title;

@Column(length=1000)
private String content;

private Date date;
private String imageName;

@ManyToOne
@JoinColumn(name="category_id")
private Category category;

@ManyToOne
private User user;

@OneToMany(mappedBy = "post", cascade = CascadeType.ALL)
private Set<Comment> comments =  new HashSet<>();

}

Place where its giving error:

Post post = this.modelMapper.map(postDto, Post.class);
    post.setDate(new Date());
    post.setImageName("default.png");
    post.setCategory(category);
    post.setUser(user);
    Post newPost = this.postRepo.save(post);

All the set methods used above are throwing "method not found exception".

How to deal with this issue?? Help!!

0

There are 0 best solutions below