Share Your Experience With Others

Batch Apex Quick Notes For Interview

Batch Apex:

  • Used for large data sets(more than 10K)
  • Each transaction starts with a new set of governor limits
  • If one batch fails, all other successful batch are not rolled back
  • Default size is 200 and max is 2000
  • We have to write 3 method start(), execute() and finish() because we use Database.Batchable Interface and we can’t skip any method of interface whether the method having any body or not
  • Query locator:
    • 50 million records can be returned
    • Can’t use aggregate queries
  • Iterable:
    • Governor limits will be enforced 50000 records
  • Stateless
  • 5 can be active concurrently
  • We can call a batch class from trigger
  • Batch class can’t call a future method
  • We can call a batch class inside other batch class in finish method
  • If we want to call in execute method then we need to use Queueable class
  • Use Database.Callouts interface to make callouts in batch class.

Queueable Apex:

  • Chaining Jobs
  • Get Job ID
  • Using non-primitive types like Sobjects

Schedulable Apex:

  • Can schedule batch apex using Apex Scheduler
  • Or using apex-System. Schedule(JobName,CronExpression,BatchClassObject)

For detailed information follow these links:

https://xperiencepartage.wordpress.com/2018/12/13/scheduled-apex

https://xperiencepartage.wordpress.com/2018/12/12/queueable-apex-aala-re

https://xperiencepartage.wordpress.com/2018/12/11/what-is-batch-apex-or-batch-class

https://xperiencepartage.wordpress.com/2018/12/10/future-methods

https://xperiencepartage.wordpress.com/2018/12/06/why-we-need-asynchronous-apex-what-is-the-benefit-of-asynchronous-apex

Leave a comment