Ok, this is fixed in CVS. As an additional benefit, now shared cache
will cache prefetched objects for real, unlike Cayenne 1.1 that only
cached root query objects.
Andrus
On Apr 11, 2006, at 10:45 AM, Andrus Adamchik wrote:
> Bryan, I logged it in Jira. Will investigate:
>
> http://objectstyle.org/jira/browse/CAY-499
>
> Andrus
>
>
> On Apr 11, 2006, at 4:07 AM, Bryan Lewis wrote:
>
>> I put the 1.2B1 jar on our servers over the weekend and got one
>> little
>> surprise today... an exception when a prefetch is specified on a
>> caching
>> query. Here's some code that reproduces it, then the stack trace.
>>
>> public static List fetchBankruptciesForPastYear(DataContext dc)
>> {
>> // Omitting the expression details...
>> SelectQuery query = new SelectQuery("BKFiler", exp);
>>
>> query.setCachePolicy(QueryMetadata.SHARED_CACHE);
>> String queryName = "BCI";
>> query.setName(queryName);
>> query.setRefreshingObjects(false);
>>
>> // Omitting the orderings details...
>> query.addOrderings(orderings);
>>
>> // This line works okay for the first fetch, but causes an
>> exception
>> // on subsequent (non-refreshing) fetches. Removing this
>> line
>> avoids
>> // the exception.
>> query.addPrefetch("company");
>>
>> return dc.performQuery(query);
>> }
>>
>> java.lang.NullPointerException
>> org.objectstyle.cayenne.access.ObjectTreeResolver
>> $TreeBuilder.addNode(ObjectTreeResolver.java:218)
>> org.objectstyle.cayenne.access.ObjectTreeResolver
>> $TreeBuilder.startDisjointPrefetch(ObjectTreeResolver.java:178)
>> org.objectstyle.cayenne.access.ObjectTreeResolver
>> $TreeBuilder.startUnknownPrefetch(ObjectTreeResolver.java:201)
>> org.objectstyle.cayenne.query.PrefetchTreeNode.traverse
>> (PrefetchTreeNode.java:209)
>> org.objectstyle.cayenne.query.PrefetchTreeNode.traverse
>> (PrefetchTreeNode.java:216)
>> org.objectstyle.cayenne.access.ObjectTreeResolver
>> $TreeBuilder.buildTree(ObjectTreeResolver.java:136)
>> org.objectstyle.cayenne.access.ObjectTreeResolver.resolveObjectTree
>> (ObjectTreeResolver.java:100)
>> org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectC
>> onversion(DataDomainQueryAction.java:372)
>> org.objectstyle.cayenne.access.DataDomainQueryAction.execute
>> (DataDomainQueryAction.java:151)
>> org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:
>> 715)
>> org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery
>> (ObjectContextQueryAction.java:249)
>> org.objectstyle.cayenne.access.DataContextQueryAction.execute
>> (DataContextQueryAction.java:90)
>> org.objectstyle.cayenne.access.DataContext.onQuery
>> (DataContext.java:1320)
>> org.objectstyle.cayenne.access.DataContext.performQuery
>> (DataContext.java:1309)
>> model.BKFiler.fetchBankruptciesForPastYear(BKFiler.java:68)
>> model.Model.fetchBankruptciesForPastYear(Model.java:511)
>>
>>
>
>
This archive was generated by hypermail 2.0.0 : Tue Apr 11 2006 - 08:42:58 EDT