Graphics Programs Reference
In-Depth Information
Faults
Relationships are fetched in a lazy manner. When you fetch a managed object with rela-
tionships, the objects at the other end of those relationship are not fetched. Instead, Core
Data uses faults . There are to-many faults (which stand in for sets) and to-one faults (which
stand in for managed objects). So, for example, when the instances of BNRItem are
fetched into your application, the instances of BNRAssetType are not. Instead, fault ob-
jects are created that stand in for the BNRAssetType objects until they are really needed.
Figure 16.15 Object faults
An object fault knows what entity it is from and what its primary key is. So, for example,
when you ask a fault that represents an asset type what its label is, you'll see SQL executed
that looks something like this:
SELECT t0.Z_PK, t0.Z_OPT, t0.ZLABEL FROM ZBNRASSETTYPE t0 WHERE t0.Z_PK = 2
(Why is everything prefixed with Z_ ? I don't know. What is OPT ? I don't know, but I
would guess it is short for “optimistic locking.” These details are not important.) The fault
is replaced, in the exact same location in memory, with a managed object containing the
real data.
Figure 16.16 After one fault is replaced
Search WWH ::




Custom Search