Hi,
I'm fooling with the following:

In a Junit test case I have this:
JobExecution jobEx = repository.createJobExecution(String name, JobParameters params);

Running the above line creates a row in (among others) the Batch_Job_Execution table with a Job_Execution_ID, a Job_Instance_ID and with the STATUS=starting and EXIT_CODE=unknown.

That is all, the test case ends. So far so good?

In another method in another Junit test case, I try and restart thatjob using the JobOperator. I retrieve the executionID from the database:
operator.restart(Long executionID)

I get the Exception that the job is already running.

What am I missing here?

What is the purpose of repository.createJobExecution(--) method? Why would I be interested in it?

I can envision the use case where I might create some number of JobExecutions and go back and run them later, but the framework is not permitting me to do this.


Thanks in advance for you comments.