+ Start a Discussion
mohammed kingmohammed king 

interfaces in batch apex.....?


Not sure what the actual question is but I propose that you have a look into following links. The interface for batch apex class is Database.Batchable<sObject> or for example Account batch it would be Database.Batchable<Account>

Batch Apex is usually used together with schedule. Check these resources for more info:

Ajay K DubediAjay K Dubedi
Hi Mohammed,

To use Batch Apex, we must implement Database.Batchable interface, below are the methods which we use:

Start: This method is called at the beginning of the batch apex job.This method will return either an object of type Database.QueryLocator or 
       an iterable that contains the records or objects passed to the job.This method will collect records on which the operation will be performed. 
       These records are divided into batches and pass those to execute method.
Execute: This method contains the set of instructions which we want to perform on those records which we 
         retrieved from the Start method.       
Finish: This method gets executed after all the batches are processed. We use this method to send email to inform them about the job completion.

Below is the example:

global class AccountBatchUpdate implements Database.Batchable<sObject> {
global Database.QueryLocator start(Database.BatchableContext BC) {
String query = ‘SELECT Id,Name FROM Account’;
return Database.getQueryLocator(query);
global void execute(Database.BatchableContext BC, List<Account> scope) {
for(Account a : scope) {
a.Name = a.Name + ‘******’;
update scope;
global void finish(Database.BatchableContext BC) {

To learn more:   https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm 

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Ajay Dubedi