> It appears to me that there is a problem with the DataMaps hence the
> entity's can't be resolved?
Right on... or more likely there is some ClassLoader weirdness making
Cayenne believe that the class is not mapped. Can you put a debug
statement before calling 'objectsFromDataRows' to make sure the
entity in question is present and is actually mapped to a fully
qualified class name of RptInvoicesErroredToDate?
Something along the lines:
ObjEntity e = dataContext.getEntityResolver().lookupObjEntity
("string_entity_name");
String className = e.getClassName();
System.out.println(...);
Andrus
On Jan 16, 2006, at 12:59 AM, Steve Wells wrote:
> After a bit of effort I've nearly got iReport's (GUI for Jasper
> Reports)
> JavaBean DataSource connection working to a Cayenne (M9) object.
> Sadly
> now I get this:
> java.lang.NullPointerException
> at
> org.objectstyle.cayenne.access.ObjectResolver.<init>
> (ObjectResolver.java:98)
> at
>
> org.objectstyle.cayenne.access.DataContext.objectsFromDataRows
> (DataContext.java:682)
> at
>
> org.objectstyle.cayenne.access.DataContext.objectsFromDataRows
> (DataContext.java:701)
> at
> RptInvoicesErroredToDate.getReportData
> (RptInvoicesErroredToDate.java:34)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
>
> it.businesslogic.ireport.gui.ConnectionDialog.jButtonOK1ActionPerforme
> d(ConnectionDialog.java:834)
>
> The calling code (RptInvoicesErroredToDate):
> public static List getReportData() throws DBException {
> DataContext dataContext = DataContext.createDataContext();
>
> // Get a handle to the stored proc
> final ProcedureQuery query = new
> ProcedureQuery("rpt_invoices_errored_to_date");
>
> List list = new ArrayList<RptInvoicesErroredToDate>();
> try {
>
> // Run the report and get the results
> final List rows = dataContext.performQuery(query);
> // Because we get raw rows from the stored proc transform
> them into the correct object types (in the list)
> list =
> dataContext.objectsFromDataRows
> (RptInvoicesErroredToDate.class,
> rows, false, false);
> } catch (Exception e) {
> throw new DBException("Could not get report data", e);
> }
> return list;
> }
>
> With the JavaBean connection you supply a Factory and static method to
> call. I'd like to use this method over Jasper/JDBC or XML
> datasources.
>
> All this works properly though from my test harness.
>
> It appears to me that there is a problem with the DataMaps hence the
> entity's can't be resolved?
>
> If anyone has any pointers to the problem, I'd be grateful.
>
> Thanks.
This archive was generated by hypermail 2.0.0 : Mon Jan 16 2006 - 18:16:45 EST