• 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
Re: Duplicate objects in a relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Duplicate objects in a relationship


  • Subject: Re: Duplicate objects in a relationship
  • From: Chuck Hill <email@hidden>
  • Date: Sat, 16 Jun 2007 11:22:42 -0700

Are you using inheritance with entities in different tables? Having the same PK in two different tables (e.g. from manual editing) will confuse EOF into thinking one object is two or vice versa). I had a similar problem recently and traced it back to a duplicated PK.


On Jun 16, 2007, at 9:37 AM, Simon McLean wrote:

Hi - I have a Client entity that has a toMany relationship to an EmployeeRole object. If i print out the relationship client.getRoles () there are duplicate objects being returned in the array:

(<com.clicktravel.travelsystem.EmployeeRole pk:"170">, <com.clicktravel.travelsystem.EmployeeRole pk:"170">, <com.clicktravel.travelsystem.EmployeeRole pk:"170">, <com.clicktravel.travelsystem.EmployeeRole pk:"170">, <com.clicktravel.travelsystem.EmployeeRole pk:"169">, <com.clicktravel.travelsystem.EmployeeRole pk:"171">, <com.clicktravel.travelsystem.EmployeeRole pk:"171">, <com.clicktravel.travelsystem.EmployeeRole pk:"169">, <com.clicktravel.travelsystem.EmployeeRole pk:"169">, <com.clicktravel.travelsystem.EmployeeRole pk:"171">, <com.clicktravel.travelsystem.EmployeeRole pk:"169">, <com.clicktravel.travelsystem.EmployeeRole pk:"171">)

But if i print out this method that i have put in the Client class:

public NSArray roleCheck() {
return EOUtilities.objectsMatchingKeyAndValue(this.editingContext (), "EmployeeRole", "organisation", this);
}


I get what i expected:

(<com.clicktravel.travelsystem.EmployeeRole pk:"170">, <com.clicktravel.travelsystem.EmployeeRole pk:"169">, <com.clicktravel.travelsystem.EmployeeRole pk:"171">)

This one has me baffled - i guess it must be a problem with my model ?. Has anyone seen this before ?

Thanks, Simon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden


--

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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Duplicate objects in a relationship (From: Simon McLean <email@hidden>)

  • Prev by Date: Re: Ajax and Accessibility
  • Next by Date: debugger on XP
  • Previous by thread: Duplicate objects in a relationship
  • Next by thread: Re: Duplicate objects in a relationship
  • Index(es):
    • Date
    • Thread