Lombok with hibernate

You can use it also with @Data (and it works !)

@Entity
@Data
public class Customer {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;
    private String firstName;
    private String lastName;

}

I have never tried Lombok with Hibernate but I don't see why it shouldn't work. Also, take a look here: http://groups.google.com/group/project-lombok/browse_thread/thread/294bd52d9d8695df/7bc6b0f343831af1?lnk=gst&q=hibernate#7bc6b0f343831af1

Also, Lombok project release notes mention Hibernate explicitely.


Sure! It works great from my experience. Here's an example entity:

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PingerEntity {
    // ID
    @Id
    @Getter
    @Setter
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;


    // USER
    @Getter
    @Setter
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private UserEntity user;


    // URL
    @Getter
    @Setter
    @Basic(optional = false)
    private String url;


    /**
     * The number of seconds between checks
     */
    @Getter
    @Setter
    @Basic(optional = false)
    private int frequency; 


    @Getter
    @Setter
    @Basic(optional = false)
    @Enumerated(EnumType.STRING)
    public MonitorType monitorType;
}