i have project for school, in my project I want to do a run the automatic and periodic execution of tasks like Windows task scheduler, But I didn't find the correct code do that. I do this business class, but which step i do for schedule the job? how can i run the batch file and schedule the jobs ?
Please who can help me.
@SuppressWarnings("serial")
@Entity
@Table(name ="task")
public class Task implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Integer id;
@Column(name = "nom_job", length = 20,nullable = false)
private String nom_job;
@Column(name = "description", length = 100, nullable = false)
private String description;
@Column(name = "scriptFile", length = 100, nullable = false)
private String scriptFile;
@Column(name = "date_execution", length = 20,nullable = false)
private Date date_execution;
@Column(name = "temps_execution", length = 100, nullable = false)
private Date temps_execution;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNom_job() {
return nom_job;
}
public void setNom_job(String nom_job) {
this.nom_job = nom_job;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getScriptFile() {
return script;
}
public void setScriptFile(String script) {
this.script = script;
}
public Date getDate_exécution() {
return date_execution;
}
public void setDate_exécution(Date date_execution) {
this.date_execution = date_execution;
}
public Date getTemps_exécution() {
return temps_execution;
}
public void setTemps_exécution(Date temps_execution) {
this.temps_execution = temps_execution;
}
public Task(Integer id, String nom_job, String description, String scriptFile, Date
date_execution, Date temps_execution ) {
super();
this.id=id;
this.nom_job = nom_job;
this.description = description;
this.scriptFile = scriptFile;
this.date_execution = date_execution;
this.temps_execution = temps_execution;
}
}