Activity Forums Salesforce® Discussions What is the use of Database.statefull Interface in salesforce?

  • What is the use of Database.statefull Interface in salesforce?

  • Suraj

    Member
    April 10, 2017 at 9:58 am

    What is the use of Database.statefull Interface?

  • Saurabh

    Member
    April 10, 2017 at 1:59 pm

    Hi Suraj

    Batch Apex is stateless by default. That means for each execution of your execute method, you receive a fresh copy of your object. All fields of the class are initialized, static and instance. If your batch process needs information that is shared across transactions, one approach is to make the Batch Apex class itself statefull by implementing the Statefull interface. This instructs Force.com to preserve the values of your static and instance variables between transactions.

    Hope it may helps you:

     

  • Avnish Yadav

    Member
    September 30, 2018 at 3:11 am

    Hello,

    You can read this blog here for better understanding.

    Thanks.

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos