nerdexam
Oracle

1Z0-900 · Question #37

Given a JSL document describing a batch job: How do you initiate a batch job?

The correct answer is A. Get the JobExecution object from BatchRuntime and call its start() method. There appears to be an error in the answer key provided - the marked correct answer (A) is actually incorrect based on the Java Batch API (JSR-352). The actual correct answer is C. In JSR-352, you initiate a batch job by calling BatchRuntime.getJobOperator() to retrieve a…

Use Batch API in Java EE 7 Applications

Question

Given a JSL document describing a batch job:

How do you initiate a batch job?

Exhibit

1Z0-900 question #37 exhibit

Options

  • AGet the JobExecution object from BatchRuntime and call its start() method.
  • BGet the JobExecution object from BatchRuntime and set its status to JobStatus.INITIATED.
  • CGet the JobOperator object from BatchRuntime and call its start() method.
  • DCall BatchRunTime.initialize("ProductLoadJob");

How the community answered

(23 responses)
  • A
    87% (20)
  • C
    4% (1)
  • D
    9% (2)

Explanation

There appears to be an error in the answer key provided - the marked correct answer (A) is actually incorrect based on the Java Batch API (JSR-352).

The actual correct answer is C.

In JSR-352, you initiate a batch job by calling BatchRuntime.getJobOperator() to retrieve a JobOperator instance, then invoking jobOperator.start("jobName", properties) on it - which returns a long execution ID. JobOperator is the control interface for batch job operations; it does not come from a getJobExecution() call on BatchRuntime.

Why the distractors are wrong:

  • A is wrong because BatchRuntime does not return a JobExecution object, and JobExecution has no start() method - it represents the state of an already-running or completed job.
  • B is wrong for the same reason as A, plus you never set a status to trigger execution; status is read-only runtime metadata.
  • D is wrong because BatchRuntime has no initialize() method - it only exposes getJobOperator().

Memory tip: Think of BatchRuntime as a factory and JobOperator as the control panel. You always go BatchRuntime → JobOperator → start().


Heads up: You may want to verify your answer key source - this question's marked answer (A) conflicts with the JSR-352 specification. The correct answer per the spec is C.

Topics

#Batch Job Initiation#BatchRuntime API#JobExecution#Batch Processing

Community Discussion

No community discussion yet for this question.

Full 1Z0-900 Practice