• 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: Sun, 17 Jun 2007 13:09:12 -0700


On Jun 16, 2007, at 11:44 AM, Simon McLean wrote:

Hi Chuck - I am using inheritance, but of the single table variety:

Is the restricting qualifier unique across all entities? Do the abstract ones have a restricting qualifier?



Client has a parent called AbstractOrganisation, EmployeeRole has a parent called AbstractUserRole which are mapped to ABSTRACT_ORGANISATION and ABSTRACT_USER_ROLE tables. The problematic relationship is inherited from the parent - so getRoles () actually returns an array of AbstractUserRoles, and the reverse relationship getOrganisation() returns an AbstractOrganisation.

I tried moving the relationships from the parent down to the child objects, but I get the same behavior. I've also checked the tables for duplicate PK's but there aren't any.

Iterate over the objects in client.getRoles() and print out getClass ().getName(), entityName(), and hashCode() on each. I suspect you may get a surprise.


Chuck



On 16 Jun 2007, at 19:22, Chuck Hill wrote:

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









--

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


  • Follow-Ups:
    • Re: Duplicate objects in a relationship
      • From: Simon McLean <email@hidden>
References: 
 >Duplicate objects in a relationship (From: Simon McLean <email@hidden>)
 >Re: Duplicate objects in a relationship (From: Chuck Hill <email@hidden>)

  • Prev by Date: irc channel
  • Next by Date: Re: irc channel
  • Previous by thread: Re: Duplicate objects in a relationship
  • Next by thread: Re: Duplicate objects in a relationship
  • Index(es):
    • Date
    • Thread