Wiki source code of EOF-Modeling-GlobalIDs

Last modified by Pascal Robert on 2007/09/03 13:30

Show last authors
1 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.
2
3 = Key Global IDs =
4
5 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.
6
7 |=(((
8 id (primary key)
9 )))|=(((
10 license plate
11 )))|=(((
12 purchase timestamp
13 )))
14 |(((
15 42352
16 )))|(((
17 RU1993
18 )))|(((
19 2002-09-28 12:00:00
20 )))
21 |(((
22 42355
23 )))|(((
24 AA3335
25 )))|(((
26 2006-05-01 11:00:00
27 )))
28 |(((
29 42376
30 )))|(((
31 QW7733
32 )))|(((
33 2007-01-01 14:00:00
34 )))
35
36 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.
37
38 = Temporary Global IDs =
39
40 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.