Re: How to fetch an object/fault from the db without creating it

Drew <[email protected]> Wed, 17 Sep 2003 10:09:20 -0700
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Is your goal to avoid hitting the database?

If so, you can use 
EODatabaseContext.localSnapshotForGlobalID(EOGlobalID gid). It'll 
return an NSDictionary if the row has already been fetched or null 
otherwise.

Drew



On Sep 17, 2003, at 6:44 AM, Alex van den Bergh wrote:

> Hi list,
>
> I have an EOGlobalID and I want to get the object/fault associated 
> with this EOGlobalID.
> It's no problem if I use
>
> EOEditingContext.faultForGlobalID(myGlobalId, myEditingContext)
>
> for existing objects.
>
> However, when I am requesting an object that does not exist in the 
> database or ec I want my method to return 'null'. faultForGlobalID 
> will simply create a fault.
>
> Is there anyway to just check for the existence of data in the 
> database corresponding with a certain globalId without creating a new 
> fault?
>
> Regards,
>
> Alex
>
> _______________________________________________
> EOF mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/eof