• 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: Mon, 18 Jun 2007 13:58:53 -0700


On Jun 17, 2007, at 4:22 PM, 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?

Yes, and yes.

I still somewhat suspect an inheritance issue, or an inheritance modelling issue. Have you looked at the SQL generated when the fault for this relationship is fired? That may provide a clue.




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.

Here is the output:

com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
5627611
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
10105184
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
2082210
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
5627611
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
10105184
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
2082210
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
5627611
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
10105184
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
2082210
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
5627611
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
10105184
com.clicktravel.travelsystem.EmployeeRole
EmployeeRole
2082210

Which suggests there are definitely duplicates in there.

I've also noticed that not all Client objects are affected. In fact, it looks like only a handful are. I guess this points to a data error ?

I have no idea what is wrong, but I remain suspicious of how you have modeled/implemented inheritance. Is there any chance that the restricting qualifiers may match more than one sub-class?


Chuck

--

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>
    • Re: Duplicate objects in a relationship
      • From: Ken Anderson <email@hidden>
References: 
 >Duplicate objects in a relationship (From: Simon McLean <email@hidden>)
 >Re: Duplicate objects in a relationship (From: Chuck Hill <email@hidden>)
 >Re: Duplicate objects in a relationship (From: Chuck Hill <email@hidden>)
 >Re: Duplicate objects in a relationship (From: Simon McLean <email@hidden>)

  • Prev by Date: Re: WWDC
  • Next by Date: Re: WWDC photos (WebObjects Lab + Bash)
  • Previous by thread: RE: Duplicate objects in a relationship
  • Next by thread: Re: Duplicate objects in a relationship
  • Index(es):
    • Date
    • Thread