because it has two underscores in front of it and you don't really know how 
it's implemented ... 

On Apr 25, 2011, at 7:57 PM, Amiel Montecillo wrote:

> Hi All,
> 
> Just a quick followup question for my additional knowledge.
> 
> There is a method in EOCustomObject.__globalID(). Any reason why using this 
> should be avoided?
> 
> Thanks,
> Amiel
> 
> On Sat, Apr 23, 2011 at 6:31 AM, Chuck Hill <[email protected]> wrote:
> 
> On Apr 22, 2011, at 1:59 PM, Chris Pastore wrote:
> 
>> While trying to return an EOGlobalID for a generic record, I am getting a 
>> null.
>> 
>> I have a method to fetch a student:
>> private static EOGenericRecord getStudent(EOEditingContext ctx, String sid) {
>>      EOGenericRecord student = (EOGenericRecord) 
>> EOUtilities.objectMatchingKeyAndValue(ctx, "Student", "studentId", sid);
>>      ctx.insertObject(student);  //tried with and without inserting it into 
>> the context 
> 
> insertObject() is only for newly created objects, not fetched objects.  
> Fetching places the object into the EOEditingContext.
> 
> 
>>      return student;
>> }
>> 
>> Later I try to retrieve that object's EOGlobalID with the following:
>> EOGlobalID globalID = ctx.globalIDForObject((EOGenericRecord) value);
>> 
>> The value of globalID is always null. What am I missing? 
> 
> that only works if ctx is the same object instance in both cases.  Try the 
> seemingly redundant:
> 
> EOGenericRecord eo = (EOGenericRecord) value;
> EOGlobalID globalID = eo.editingContext().globalIDForObject(eo);
> 
> If you get an NPE, then eo is not in an editing context.
> 
> Chuck
> 
> 
>> 
>> Thank you for any help you may be able to offer,
>> 
>> Chris Pastore
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
>> 
>> This email sent to [email protected]
> 
> -- 
> Chuck Hill             Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.    
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
> 
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/bosyotech%40gmail.com
> 
> This email sent to [email protected]
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to