4

I used lombok annotation '@Data' in my entity. I was trying to use getter by Dto Converter in the same way like I would do it normally without lombok. Somehow it doesn't work as I expected. It looks like my lombok didn't create getters or I don't have access there?

@Entity
@Table(name = "product")
@Data
public class Product {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(name = "name")
    private String name;

Dto Converter:

public class ProductEntityToProductDetailsDtoConverterImpl {

    @Override
    public ProductDetailsDto convert(Product product) {
        return new ProductDetailsDto(
                product.getId(),
                product.getName()
        );
    }
}
damianm
  • 121
  • 1
  • 8

1 Answers1

6

You have to install lombok plugin for your IntellIJ IDEA to make it understand lombok

https://plugins.jetbrains.com/plugin/6317-lombok

Hưng Chu
  • 1,027
  • 5
  • 11
  • 3
    It is already answered. Look at this : https://stackoverflow.com/questions/17729384/lombok-added-but-getters-and-setters-not-recognized-in-intellij-idea – Anish B. Jun 22 '20 at 07:32