• 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
Subclass conflict with single-table mapping?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclass conflict with single-table mapping?


  • Subject: Subclass conflict with single-table mapping?
  • From: Drew Thoeni <email@hidden>
  • Date: Sun, 11 Dec 2005 20:48:38 -0500

Background
I have an Employee object that has two (actually more, but these two will suffice to explain the problem) subclassed objects: Client and Consultant. I also have a Project object that a Client requests and a Consultant works on.

The Employee, Client, and Consultant objects are concrete (as users want to add to the employee object but select from the subclassed objects). There is a one-to-many join between Client and Project and Consultant and Project (a Project has only one Client and only one Consultant).

Problem
When I display a page that is intended to allow a new project to be added and has PopUp Buttons to allow a client and consultant to be selected, I get an exception as follows:

java.lang.IllegalArgumentException: While trying to set the field "consultantItem" on an object of type ProjectDetailPage we expected a Consultant but received a Client with a value of {values = {lastName = "Smith"; type = 3; firstName = "John"; projects = ")>"; }; this = ""; }. This often happens if you forget to use a formatter.

There is an NSArray of Consultants (consultantList) and a holder variable (consultantItem). Same for client. 

This excpetion is being caused by having the displayString on a PopUp Button in WOBuilder set to consultant.lastName. If I leave that attribute empty the page will load and function (but, of course, I get a long set of values in the PopUp display. I can set the client popup displayString to client.lastName and all works fine. It's only when I try to set the displayString for consultant (or any other of the employee subclasses) that I get the above exception. For some reason WO thinks the object it's being handed is a Client, though it has been defined as a Consultant.

This is my first implementation using subclasses. I've checked the model, and all variables, etc. But, I'm betting there's something I'm missing here.

Any ideas would be appreciated.

Regards,

Drew
 _______________________________________________
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: Subclass conflict with single-table mapping?
      • From: email@hidden
  • Prev by Date: Re: Problem with Interface Builder
  • Next by Date: Re: Problem with Interface Builder
  • Previous by thread: InvocationTargetException
  • Next by thread: Re: Subclass conflict with single-table mapping?
  • Index(es):
    • Date
    • Thread