Results 1 to 3 of 3

Thread: JobExecution Is Always 0?

  1. #1
    Join Date
    Jul 2008
    Posts
    21

    Default JobExecution Is Always 0?

    Hi,

    I have a integration test using JobLauncherTestUtils to launch a job. However, each time I evaluate the Id of jobExecution, it returns 0:

    Code:
            
    JobExecution jobExecution = jobLauncherTestUtils.launchJob(params);
    
    System.err.println(jobExecution.getId()); // 0?!
    My job interally captures the job execution id for logging purposes, but the simple snippet always returns 0 and I don't understand why.

    Thanks,

    Alejandro

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    349

    Default

    How are you launching the job? If you are creating a new process each time and using the Map based JobRepository, you'd get 0 every time because the id isn't persistent from run to run.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  3. #3
    Join Date
    Jul 2008
    Posts
    21

    Default

    Bah! After looking at my config again, that is exatcly what is happening. I had a test context for batch that brought in a Map based repo.

    Thanks,

    Alejandro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •