When using batch Apex, each batch keeps a separate state. So if we define a property in the class, it usually gets reset in each batch. In order to create a property that will maintain state across all batchs we need to implement the Database.Stateful keyword.

There is no tag wiki for this tag … yet!

Tag wikis help introduce newcomers to the tag. They contain an overview of the topic defined by the tag, along with guidelines on its usage.

All registered users may propose new tag wikis.

(Note that if you have less than 20000 reputation, your tag wiki will be peer reviewed before it is published.)