Proposed Rule Name: [apex] Avoid Stateful Database Results
Proposed Category: Error Prone
Description: Instance variables of type Database.[x]Result
can cause serialization issues between successive batch iterations when used in an implementation of the Database.Stateful
interface. Please avoid using such variables unless they are transient.
This helps to avoid this known issue
Code Sample:
public class Example implements Database.Batchable, Database.Stateful { Database.SaveResult[] results; // this can cause failures public Database.Querylocator start(Database.BatchableContext context){ return Database.getQueryLocator('SELECT Id FROM Account LIMIT 10'); } public void execute(Database.BatchableContext context, List<SObject> scope){ results = Database.update(scope, false); } public void finish(database.BatchableContext context){ } }
Possible Properties:
jongpie, benjaminloerincz, deepakwadar1902, sirephil and DamecekpkozuchowskiLogeshm72
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4