Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use lombok when I build database entity by IDEA automatically

I have installed the plugin:
enter image description here
and dependency:
enter image description here

But when I use IDEA to build entity, it will like this:
enter image description here

I want to replace getter and setter by @Getter,@Setter when IDEA build it automatically.

like image 245
licxisky Avatar asked May 31 '18 09:05

licxisky


1 Answers

You can use just @Data Lombok annotation with your entities, for example:

@Data
@Entity
public class MyEntity {

    @Id
    private Long id;

    @Column(lenght = 16, nullable = false)
    private String someField;
}

In this case you get your entity with automatically created getters, setters, default constructor (without parameters), equals, hashCode and toString methods.

like image 96
Cepr0 Avatar answered Nov 02 '22 08:11

Cepr0