WebObjects/EOF/Modeling/GlobalIDs
A GlobalID (often called a GID) is an object which can be used to uniquely identify an instance of an entity. For example, if you have an entity called "Trucks" then GIDs can be used to identify which truck is being considered. The superclass EOGlobalID can be used through the EOF API, but its concrete subclasses are used in specific situations. These are described below, but often you do not need to consider what sort of GID you actually have.
Key Global IDs
[edit | edit source]An EOKeyGlobalID is used to uniquely identify an instance of an entity that is already stored in a database. Here is an example of how the truck table might look.
id (primary key) | license plate | purchase timestamp |
---|---|---|
42352 | RU1993 | 2002-09-28 12:00:00 |
42355 | AA3335 | 2006-05-01 11:00:00 |
42376 | QW7733 | 2007-01-01 14:00:00 |
The primary key is carried inside the EOKeyGlobalID to identify the instance of the entity which is effectively the row in the database. In this example, the EOKeyGlobalID that contains the key 42355 would be a unique identifier for the Truck with the data containing the number plate AA3335.
Temporary Global IDs
[edit | edit source]EOTemporaryGlobalID-s are used when instances of an entity are still only in memory. This happens when you are creating new data because the instances do not yet have rows stored in the database. The EOTemporaryGlobalID uses a long string that composites various pieces of information to make an identifier which is unique not only in the system you are running, but between systems as well.