ColdFusion 9.0 Resources |
EntitySaveDescriptionSaves or updates data of the object and all related objects to the database. This also saves all the related entities, which includes the entire graph. When entities are loaded, default constructors are called.ColdFusion automatically tries to find if a new record should be inserted or an existing record be updated for the given entity. If you set forceinsert=true, then ColdFusion tries to insert the entity as a new record.Calling this method may not run the insert or update SQL immediately. It is possible that various SQL statements are queued and then run as a batch for performance reasons. The SQL statements are run when the ORM session is flushed. CategoryFunction SyntaxEntitySave(entity, [forceinsert]) See AlsoParameters
ExampleTo save an entity: <cfset employee = createObject("Employee")> <cfset employee.setFirstName("Marcia")> <cfset employee.setlastName("Em")> <cfset EntitySave(employee)> To update an entity: <cfset employee = EntityLoad('employee', 100, true)> <cfset employee.setLastName("Em")> <cfset EntitySave(employee)> |