Results 1 to 3 of 3

Thread: BatchId

  1. #1
    Join Date
    Jul 2009
    Location
    Hyderabad
    Posts
    28

    Default BatchId

    Hi,

    When i run a batchJob, a jobExecutionId will be generated in BATCH_JOB_EXECUTION table in DB, how can i retrieve this id(which is created now) dynamically.

    I want this id to be retreived either in processor or writer class.

    Thanks,
    Ramesh .K

  2. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    Since that value is in the JobExecution, you can obtain it from a BeforeStep or BeforeJob listener method on either the processor or writer class:
    Code:
    @BeforeStep
    public void getJobExecutionId(StepExecution stepExecution) {
        this.jobExecutionId = stepExecution.getJobExecution().getId();
    }

  3. #3
    Join Date
    Jul 2009
    Location
    Hyderabad
    Posts
    28

    Default

    Its working.

    Thanks Garrette

Posting Permissions

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