![]() |
||||||||||||||||||||||||||||||||
| |
|
|
||||||||||||||||||||||||||||||
|
Editing EOs EOF provides an abstraction of common database operations - removes you from SQL perculiarities 1. To edit a row in database you edit the analogous object 2. To create a new row in database you create a new object 3. Editing context tracks the changes 4. Notify editing context when you want to committ these changes to the database You should save after significant operations to keep database up to date
To find which editing context a object belongs to if you have more than 1 customer.editingcontext(); Editing Context Observes changes in enterprise objects Tracks inserts and deletes Maintains pending edits without accessing the database Supports undo and redo logic Changes only exist in editing context untill you explicitly save to the database - allows a number of changes to be made before accessing the database How does the ec know when an object is changed? The accessor method tells it ....StoredValueFor Key() Methods store and retrieve values from the EOGenericRecord's built-in dictionary and notify the ec that the object has changes
public String posterName() {
return (String)storedValueForKey("posterName");
}
public void setPosterName(String value) {
//access dictionary elements directly
takeStoredValueForKey(value, "posterName");
}
Stored Value Encoding Looks for getname(), name(), methods then for name variable in sequence until it finds a key
Page updated September 7, 2004
|
|||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||