Lombok with hibernate

javaguy picture javaguy · Feb 1, 2011 · Viewed 17.1k times · Source

Is this possible? Haven't seen much discussion on it.

Answer

wmacura picture wmacura · Aug 1, 2011

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;
}