0

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

}

emna s
  • 1
  • 1
  • Could you explain why you talk about spring batch and show code of a jpa entity? – CodeScale Apr 15 '20 at 15:30
  • Because I don't know how to do scheduled jobs, I searched but i didn't find what I want – emna s Apr 15 '20 at 16:21
  • 1
    Please take a look at spring batch guide for the job implementation. Regarding scheduling spring batch is not a scheduler. You have to use external.scheduler like spring scheduler, ejb timer, simple cron... – CodeScale Apr 15 '20 at 16:25
  • I use angular spring and oracle,I searched but i didn't find what I want – emna s Apr 15 '20 at 16:47
  • Does this answer your question? [How to trigger a scheduled Spring Batch Job?](https://stackoverflow.com/questions/46969575/how-to-trigger-a-scheduled-spring-batch-job) – Mahmoud Ben Hassine Apr 16 '20 at 10:15
  • `Because I don't know how to do scheduled jobs`: this might help: https://stackoverflow.com/questions/46969575/how-to-trigger-a-scheduled-spring-batch-job. – Mahmoud Ben Hassine Apr 16 '20 at 10:15
  • thanks but how the spring can read the time from the Angular and use it to execute the jobs – emna s Apr 16 '20 at 11:13

0 Answers0