Re: objectFromDataRow NPE

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Oct 07 2010 - 07:05:48 UTC

  • Next message: Andrus Adamchik: "Re: maven-cayenne-plugin cgen issue"

    Hi Jeff,

    From the lines in the stack trace, looks like context.getObjectStore().getDataRowCache() returns null, causing an NPE downstream. Now wondering why that can happen... Are you serializaing/deserializaing your DataContext?

    Andrus

    On Oct 6, 2010, at 9:04 PM, Rorison, Jeff wrote:

    > I am using 3.0 (final) and am having some issues using
    > context.createFromDataRow(...)
    >
    > ObjectResolver is throwing an NPE on what looks like updating snapshots.
    >
    >
    >
    > Code:
    >
    > SQLTemplate template = .....
    >
    > template.setFetchingDataRows(true);
    >
    > ...
    >
    > List res = this.dataContext.performQuery(template);
    >
    > Subject sub = (Subject)context.objectFromDataRow(Subject.class,
    > (DataRow)res.get(0), true);
    >
    >
    >
    > Err:
    >
    > java.lang.NullPointerException
    >
    > at
    > org.apache.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResol
    > ver.java:117)
    >
    > at
    > org.apache.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows
    > (ObjectResolver.java:94)
    >
    > at
    > org.apache.cayenne.access.DataContext.objectsFromDataRows(DataContext.ja
    > va:597)
    >
    > at
    > org.apache.cayenne.access.DataContext.objectFromDataRow(DataContext.java
    > :646)
    >
    > ...........
    >
    >
    >
    > What, if anything am I doing incorrectly here? I have tried changing the
    > refresh, and most of the other API calls with no success?
    >
    > Has this changed any in 3.0, as I see a few differences between the API
    > and the docs?
    >



    This archive was generated by hypermail 2.0.0 : Thu Oct 07 2010 - 07:06:20 UTC