licxisky
licxisky

Reputation: 63

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.

Upvotes: 6

Views: 1952

Answers (2)

oguz zeyveli
oguz zeyveli

Reputation: 59

You can use pojo generator plugin https://plugins.jetbrains.com/plugin/12297-pojo-generator ,after add @Data annotation

Upvotes: 0

Cepr0
Cepr0

Reputation: 30482

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.

Upvotes: 2

Related Questions