cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: objectFromDataRow NPE
Date Thu, 07 Oct 2010 07:05:48 GMT
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?
> 


Mime
View raw message