Re: Duplicate pointers in NSArray returned by toMany relationship
Re: Duplicate pointers in NSArray returned by toMany relationship
- Subject: Re: Duplicate pointers in NSArray returned by toMany relationship
- From: David Avendasora <email@hidden>
- Date: Wed, 9 Dec 2009 13:42:15 -0500
He says:
4 8 15 16 23 42
Unfortunately, I didn't give me the date.
Dave
On Dec 9, 2009, at 12:40 PM, Lon Varscsak wrote:
> Hey, can you have future you send me the winning lottery numbers? ;)
>
> -Lon
>
> On Wed, Dec 9, 2009 at 10:36 AM, David Avendasora
> <email@hidden> wrote:
>> Happy Wednesday/Thursday all,
>> I'm posting this here to remind my future self and future googlers since
>> this is a somewhat obscure issue with unexpected results.
>> Earlier today I was having a problem where calling a toMany relationship was
>> returning the expected number of objects in an NSArray, but the array had 4
>> pointers to one single object in it instead of 4 pointers to 4 individual
>> objects.
>> In the database there were four rows that were identical except for one
>> field (DUE_DATE). It seemed that somehow EOF was saying that these rows all
>> represent one object and then put 4 pointers to that one object in the
>> array.
>> Anybody see where this is going? Because this is the thing that had me
>> stumped for hours.
>> The problem was the table's Primary Key, or more accurately, its lack there
>> of. The table in the DB (Oracle) didn't have a PK defined. Since EOF doesn't
>> like PKless entities, someone (not me! I swear.) had simply picked a bunch
>> of non-null attributes in EOModeler that would approximate a PK. The problem
>> is that this PK was not unique. So EOF only created one EO, but then
>> inserted it into the NSArray 4 times.
>> In this situation the DUE_DATE field can be null, so it can't be part of the
>> PK. Now I've got to get the DBAs to put a PK on the table.
>> Dave
>> David Avendasora
>> Senior Software Engineer
>> K12, Inc.
>> *****
>> WebObjects
>> Documentation Wiki : http://wiki.objectstyle.org/confluence/display/WO/
>> *****
>> WebObjects
>> API: http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
>> *****
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
>
David Avendasora
Senior Software Engineer
K12, Inc.
*****
WebObjects Documentation Wiki : http://wiki.objectstyle.org/confluence/display/WO/
*****
WebObjects API: http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
*****
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden