• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Duplicate pointers in NSArray returned by toMany relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Duplicate pointers in NSArray returned by toMany relationship


  • Subject: Duplicate pointers in NSArray returned by toMany relationship
  • From: David Avendasora <email@hidden>
  • Date: Wed, 9 Dec 2009 12:36:30 -0500

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

  • Follow-Ups:
    • Re: Duplicate pointers in NSArray returned by toMany relationship
      • From: Lon Varscsak <email@hidden>
  • Prev by Date: Re: Big Decimal as optimistic lock attribute?
  • Next by Date: Re: Duplicate pointers in NSArray returned by toMany relationship
  • Previous by thread: Re: Big Decimal as optimistic lock attribute?
  • Next by thread: Re: Duplicate pointers in NSArray returned by toMany relationship
  • Index(es):
    • Date
    • Thread