FROM : mmalcolm crawford
DATE : Sat Apr 30 01:25:13 2005
On Apr 29, 2005, at 2:32 PM, Scott Ellsworth wrote:
>> Faulting only applies to relationships (so in your example
>> comments will be loaded along with the other attributes on fetch),
>> and is only really relevant if you use a SQLite store since it can
>> fetch data on an as-needed basis. The other stores -- XML and
>> binary -- both load the whole persistent store into memory when
>> they're accessed.
>
> What about fetched properties? The docs imply a lazy fetch, but I
> have not had a chance to test.
>
Fetched properties are fetched lazily, then cached. If you want to
update the cache, then (as with other updates) you refault the object.
> On the other hand, I am not sure I grok when I would use a fetched
> property, as opposed to a stored fetch request. Is there an
> implicit "must be in a relatioship with the entity that the fetched
> property is a part of" condition on a fetched property, or some such?
>
Think of how you might represent a smart playlists in iTunes. You
could use a fetch request in place of a fetched property, but this
requires a different (and "explicit") code structure -- that is,
you'll have to retrieve the fetch request from the model then execute
it. The fetched property specifies a relationship (albeit a weak
one). It's more natural to ask a (smart) Playlist for its Tracks
than to create and execute a fetch request for Track to match a
predicate. Moreover, you then have to maintain the set of results
yourself rather than it being associated with a particular Playlist...
mmalc
DATE : Sat Apr 30 01:25:13 2005
On Apr 29, 2005, at 2:32 PM, Scott Ellsworth wrote:
>> Faulting only applies to relationships (so in your example
>> comments will be loaded along with the other attributes on fetch),
>> and is only really relevant if you use a SQLite store since it can
>> fetch data on an as-needed basis. The other stores -- XML and
>> binary -- both load the whole persistent store into memory when
>> they're accessed.
>
> What about fetched properties? The docs imply a lazy fetch, but I
> have not had a chance to test.
>
Fetched properties are fetched lazily, then cached. If you want to
update the cache, then (as with other updates) you refault the object.
> On the other hand, I am not sure I grok when I would use a fetched
> property, as opposed to a stored fetch request. Is there an
> implicit "must be in a relatioship with the entity that the fetched
> property is a part of" condition on a fetched property, or some such?
>
Think of how you might represent a smart playlists in iTunes. You
could use a fetch request in place of a fetched property, but this
requires a different (and "explicit") code structure -- that is,
you'll have to retrieve the fetch request from the model then execute
it. The fetched property specifies a relationship (albeit a weak
one). It's more natural to ask a (smart) Playlist for its Tracks
than to create and execute a fetch request for Track to match a
predicate. Moreover, you then have to maintain the set of results
yourself rather than it being associated with a particular Playlist...
mmalc
| Related mails | Author | Date |
|---|---|---|
| Marc Blatt | Apr 29, 20:24 | |
| mmalcolm crawford | Apr 29, 20:37 | |
| Jim Correia | Apr 29, 22:41 | |
| mmalcolm crawford | Apr 29, 23:16 | |
| Scott Ellsworth | Apr 29, 23:32 | |
| mmalcolm crawford | Apr 30, 01:25 | |
| Scott Ellsworth | Apr 30, 02:14 | |
| Jim Correia | May 10, 19:11 |






Cocoa mail archive

