Это сделало мой код ещё короче и даже яснее. Сравните сами, как было:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "countries") | |
public class Country { | |
public static final int NAME_LENGTH = 50; | |
@Getter | |
@Setter | |
@Id | |
@GeneratedValue | |
private Integer id; | |
@Getter | |
@Setter | |
@Column(length = NAME_LENGTH, unique = true, nullable = false) | |
private String name; | |
@Getter | |
@Setter | |
@Column(name = "created_at", nullable = false) | |
private Date createdAt; | |
} |
и как стало:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "countries") | |
@Getter | |
@Setter | |
public class Country { | |
public static final int NAME_LENGTH = 50; | |
@Id | |
@GeneratedValue | |
private Integer id; | |
@Column(length = NAME_LENGTH, unique = true, nullable = false) | |
private String name; | |
@Column(name = "created_at", nullable = false) | |
private Date createdAt; | |
} |
Теперь аннотации JPA и Lombok не смешиваются, что делает код более чистым.
Мелочь, а приятно!
Комментариев нет:
Отправить комментарий