Re: Duplicate objects in a relationship
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