Re: Subclass conflict with single-table mapping?
Re: Subclass conflict with single-table mapping?
- Subject: Re: Subclass conflict with single-table mapping?
- From: email@hidden
- Date: Mon, 12 Dec 2005 13:12:12 +0100
What is the primary key of your Employee
table?
Does the database's primary key definition
match with what you declared in EOModeler?
Can you be sure no Client shares a primary
key with an Consultant?
Did you configure the qualifier (e.g.
type == 3) for all of your sublclasses?
Pierre
webobjects-dev-bounces+pierre.bernard=email@hidden
wrote on 12/12/2005 02:48:38 AM:
> 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
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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