global class batchForStateful implements Database.Batchable<Sobject>,Database.Stateful{
global static list<cust__c> soList=new list<cust__c>();
global database.querylocator start(Database.BatchableContext BC){}
global void execute(Database.BatchableContext BC, List<sObject> scope){
Util.staticMethod();
}
global void finish(Database.BatchableContext BC){
system.debug('--->asitm9'+soList.size());
//returning zero;
}
}
class Util{
static void staticMethod(){
if(batchForStateful.soList==null){
batchForStateful.soList=new list<cust__c>();
}
batchForStateful.soList.add(new cust__c() );
}
}
Debug statement should print size greater than zero, but why it is printing zero all the time??
soList
declaration