I'm trying to write a project that takes food with different labels (standing for different kind of food such as vegetables, canned, etc) and delete them automatically after given expiration time for each label for different food, passes. I've tried to implement it using @Schedule EJB but I've got confused understanding it since I'm still new to this. Here is the entity code:
@Id
@GeneratedValue
@Column(name = "ID", nullable = false)
private Integer id;
@Column(name = "LABEL", nullable = false)
private Integer label;
@NotBlank
@Length(min = 2, max = 255)
@Column(name = "FOODNAME", nullable = false)
private String foodName;
@Column(name = "FOODNUMBER", nullable = false)
private Integer foodNumber;
and the dependencies in it's class:
import org.hibernate.validator.constraints.NotBlank;
import javax.persistence.*;
and the reference for @Schedule:
EJB @Schedule wait until method completed
thanks for any help in advance.