龙目岛冬眠
2022-09-01 05:58:15
这可能吗?没有看到太多的讨论。
确定!从我的经验来看,它效果很好。下面是一个示例实体:
@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;
}
您也可以将其与@Data一起使用(并且它有效!
@Entity
@Data
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String firstName;
private String lastName;
}