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