You need to sign in to do that
Don't have an account?
szesze21
Explanation on DML needed to persist a record
I'm new to coding. On https://developer.salesforce.com/trailhead/apex_database/apex_database_sobjects, it says "creating an sObject doesn’t persist it as a record in the database. To save the sObject as a record, and do other things with it, you’ll need to use DML." I'm trying to understanding why and whether this is something specific to sObject (i.e. SFDC), or is this common with other programming languages too?
The statement means that when you create an SObject in Apex using the below syntax (where values is the corresponding field values), you are not actually creating a record. Only when you perform DML operations like insert, delete update etc the record gets actually created. Consider java programming. Its similar to creating an object that you want to insert into database. You create the object, assign values to it and the data gets inserted only when you use DML statements to insert it by establishing a JDBC connection. Here, you don't have to establish any connection to the database. A statement like 'insert sobjectname;' will insert the values in the database.
Please let me know if you have any doubts.
Thanks!