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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to