title: How do I create a safe Lombok JPA entity?
body: <p>I have an <code>@Entity</code> with 20 fields including the index and a timestamp updated by Hibernate:</p>
  <pre><code>@Entity
  public class MyEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @UpdateTimestamp
    private LocalDateTime updatedTime;
    private String ....
    private String ....
  </code></pre>
  <p>I have a default constructor for Hibernate and a secondary constructor to set everything but the id and updatedTime.</p>
  <p>I don't need (or want) setters for id or updatedTime because I only want Hibernate to set them, and it does that with reflection.</p>
  <p>I wanted to try out Lombok to see if I could avoid a lot of boilerplate involved here but <code>@Data</code> adds both getters and setters and doesn't create the same constructors.</p>
  <p>I'm also concerned that Lomboks generated equals/hashCode and toString methods can cause subtle problems with Hibernate.</p>
  <p>This will mean I will have to use a combination of the other Lombok annotations to do this.</p>
  <p>How do I safely create an Entity using Lombok like this?<br />
  Am I going to have to use a mixture of annotations and manual methods?</p>