Please consult the section of the manual about Concurrency control: using the generated code - adapter - using the entity classes - concurrency control.
By default entity fields are marked as dirty when their value changes. When an entity is saved only these dirty fields are saved to the database.