I have simple requirement to insert number of Accounts. Now what I noticed to call the following I have to pass SOQL which is irrelevant since there will be no use of the result of this query
Please suggest how can I call batch apex without passing SOQL.
Database.executeBatch(new BatchAccountsProcess('Select id from Account limit 1'));
global class BatchAccountsProcess .... {
global BatchAccountsProcess(String qryStr)
{
Query = qryStr;
}
global Database.QueryLocator start(Database.BatchableContext BC)
{
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,List<sObject> scope)
{
for(integer iAcc = 0 ;iAcc < 5000 ; iAcc++) {
Account accObj = new Account(name='Arijit_batch_'+iAcc);
lstAccount.add(accObj);
}
Database.insert(lstAccount);
}
}