Setting Sobject ID For Update

Spring ’13 Force.com Platform Release Setting ID Fields for Updates Starting with Apex code saved using Salesforce.com API version 27.0, the Id field is now writeable on sObject instances for all sObject types—standard objects, custom objects, and generic sObjects—for update operations. The insert operation doesn’t support setting Id fields on sObjects. This change enables you to update existing records that correspond to sObject instances you already have, such as sObjects you obtained from deserializing JSON input. To do so, set the Id field on the sObjects to IDs of existing records in the database and call update. This call updates the corresponding records with all the other fields that are set on the sObjects.