Defining a Batch Apex class
When we refer to a Batch Apex class, we mean a class that implements the Database.Batchable
interface and its related interfaces. As we will see when we discuss invoking Batch Apex in the next main section of this chapter, this provides us with some benefits in making our code dynamic in certain situations. In this section, we will review how to define a Batch Apex class using the base interface and the additional related interfaces we can also apply.
The base interface
The simplest Batch Apex class definition is one in which we define a class that implements the Database.Batchable
interface, as shown in the following code snippet:
public class ExampleBatch implements Database.Batchable<sObject> { public Database.QueryLocator start(Database. BatchableContext bc) { //Retrieve our data for processing } &...