I need to store Job ExecutionId as one of the fields of Entity. (I am using JpaItemWriter) One of topic here explains from StepExcecution, I can get StepContext -> JobExecution.
I had a similar issue when I wanted to get the JobInstanceID. Below is how I got StepExecution and then retreived JobExecution. I hope this helps.
public class FoobarItemProcessor implements ItemProcessor {
private JobExecution jobExecution;
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
jobExecution = stepExecution.getJobExecution();
}