在Salesforce中,我从Apex类调用apex Batch但它只调用批处理的构造函数而不调用start,execute和finish?发生了什么事?
我从一个班级这样调用批处理。
ExportBatchClass EXPBTCH = new ExportBatchClass();
Database.executeBatch(EXPBTCH);
,批次是:
global class ExportBatchClass implements Database.Batchable < Sobject > , Database.Stateful {
public String qryString;
global ExportBatchClass(){}
global ExportBatchClass(String qryString1){
qryString=qryString1;
System.debug('qryString======'+qryString);
} //END ExportBatchClass //
// Start Method
global Database.QueryLocator start(Database.BatchableContext BC){
qryString='SELECT Product__r.name From Products__c WHERE Name != null ORDER by Product__r.Name ASC';
system.debug('########## in START qryString = '+qryString);
return Database.getQueryLocator(qryString);
}
// Execute Logic
global void execute(Database.BatchableContext BC, List<Sobject> scope) {
for(Sobject s : scope)
{
Products__c pro=(Products__c)s;
productRelateListBatch.add(pro);
}
System.debug('productRelateListBatch======'+productRelateListBatch.size());
}
global void finish(Database.BatchableContext BC){
}
}
我错过了什么?
答案 0 :(得分:0)
感谢Q !!我解决了它。我只是重新构建它,代码现在工作正常。