Activity › Forums › Salesforce® Discussions › Why do will need Database.Stateful in a batch class? Salesforce® Discussions Why do will need Database.Stateful in a batch class? Posted by Pooja on July 26, 2020 at 4:54 PM Why do will need `Database.Stateful` in a batch class in Salesforce? Ratnesh replied 5 years, 10 months ago 2 Members · 1 Reply 1 Reply Ratnesh Member July 27, 2020 at 6:06 AM The only time you need Database. Stateful is when the execute method modifies a class variable in a way meant to be used across multiple execute methods or in the finish method. The majority of batches you will ever write will not need Database. Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me