cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Pikkemaat <>
Subject Re: refreshing prefetched objects.
Date Wed, 08 Sep 2010 08:31:03 GMT

I did not explain my test case in enough detail.

I have table testhpi, testhpi2 and testhpi3.

There are relationships

     testhpi: testhpi2Array
     testhpi: testhpi3Array
     testhpi2: testhpi3Array

I use a joint prefetches


At some point I run the query and get correct results.
It runs one big query where all records are retrieved.

But at some point I also retrieve the testhpi3 records through the teshtpi.testhpi3Array releationship.
There is no prefetch for this one so a separate query is run and I get the correct results.
Actually I
get the same objects as in the big query.

Now it comes.

I delete a record from testhpi3 and reinsert it.

If I now run the first query the query is executed and the objects are refreshed.
One object is replaced with a new one as it was deleted and re-inserted.
This is all good.

But if I run the second query it is not re-executed (no prefetch?) and I get an old result.
This seems logical as there is no prefetch.
So I added the prefetch


But now I get this exception

Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 12
2007] Query exception.
     at org.apache.cayenne.access.DataDomainQueryAction.nextQueryException(
     at org.apache.cayenne.access.DataNode.performQueries(
     at org.apache.cayenne.access.DataDomainQueryAction.runQuery(
     at org.apache.cayenne.access.DataDomainQueryAction.access$000(
     at org.apache.cayenne.access.DataDomainQueryAction$1.transform(
     at org.apache.cayenne.access.DataDomain.runInTransaction(
     at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(
     at org.apache.cayenne.access.DataDomainQueryAction.execute(
     at org.apache.cayenne.access.DataDomain.onQuery(
     at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(
     at org.apache.cayenne.access.DataContextQueryAction.execute(
     at org.apache.cayenne.access.DataContext.onQuery(
     at org.apache.cayenne.access.DataContext.performQuery(
     at cayenne.TryStuff.go(
     at cayenne.TryStuff.main(
Caused by: java.lang.IllegalArgumentException: No inheritance - there must be only one override
     at org.apache.cayenne.access.jdbc.DataRowPostProcessor.<init>(
     at org.apache.cayenne.access.jdbc.DataRowPostProcessor.createPostProcessor(
     at org.apache.cayenne.access.jdbc.SelectAction.performAction(
     at org.apache.cayenne.access.DataNodeQueryAction.runQuery(
     at org.apache.cayenne.access.DataNode.performQueries(
     ... 13 more

What am I doing wrong?



On 9/7/10 4:23 PM, Hans Pikkemaat wrote:
>    Indeed very strange.
> I'm trying to reproduce now using a simple table structure but here
> it works fine.
> If I find something I'll let you know.
> Hans
> On 9/7/10 4:06 PM, Andrus Adamchik wrote:
>> Very strange. Prefetching always refreshes related objects.
>> Andrus
>> On Sep 7, 2010, at 7:52 AM, Hans Pikkemaat wrote:

View raw message