public class Main extends ERXComponent {
public Company companyEnumerator;
public Main(WOContext context) {
super(context);
}
public NSArray<Company> companies() {
return EOUtilities.objectsForEntityNamed(session().defaultEditingContext(), "Company");
}
}
The entity Company has a class name Company, and I generated the Java files for it using Velocity, using the _WonderEntity.java templates.
The error I get is this:
Error: | java.lang.IllegalArgumentException: While trying to set the field "companyEnumerator" on an object of type com.operawarwick.venice.components.Main we expected a com.operawarwick.venice.Company but received a com.webobjects.eocontrol.EOGenericRecord with a value of {values = {shows = ")>"; name = "Name of company"; agents = ")>"; }; this = ""; }. This often happens if you forget to use a formatter. |
Reason: | While trying to set the field "companyEnumerator" on an object of type com.operawarwick.venice.components.Main we expected a com.operawarwick.venice.Company but received a com.webobjects.eocontrol.EOGenericRecord with a value of {values = {shows = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 37d115 (<EOAccessArrayFaultHandler shows _EOIntegralKeyGlobalID[Company (java.lang.Integer)1]>)>"; name = "Name of company"; agents = "<com.webobjects.eocontrol._EOCheapCopyMutableArray c52ffa (<EOAccessArrayFaultHandler agents _EOIntegralKeyGlobalID[Company (java.lang.Integer)1]>)>"; }; this = "<com.webobjects.eocontrol.EOGenericRecord ad6c35 _EOIntegralKeyGlobalID[Company (java.lang.Integer)1]>"; }. This often happens if you forget to use a formatter. |
As I say, it used to work. I did some stuff to the rest of the app, and then came back to this part, and it no longer worked. I've just created a new project and put in just this code, and it still does it. It could be something to do with my EOModel file (attached), but I don't see what -- it has the correct class name listed. It's as if the EOUtilities method is returning everything as type EOGenericRecord despite what is written in the EOModel.
Thomas