Property Based Access in JPA - is an Emerging Antipattern 📎
So you should use:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID")
private Long id;
instead of:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID")
public Long getId(){return this.id;}
The field-based injection clearly separates between the business logic and state and promotes encapsulation.
And remember, Getters/Setters are evil, but sometimes necessary (e.g. if you like to use detached objects as Value Objects).