cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Pikkemaat <h.pikkem...@tsi-solutions.nl>
Subject Re: refreshing prefetched objects.
Date Wed, 08 Sep 2010 08:31:03 GMT
  Hi,

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

     query.addPrefetch("testhpi2Array").setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
     query.addPrefetch("testhpi2Array.testhpi3Array").setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

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

     query.addPrefetch("testhpi2Array").setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);

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(DataDomainQueryAction.java:428)
     at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:280)
     at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:301)
     at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:60)
     at org.apache.cayenne.access.DataDomainQueryAction$1.transform(DataDomainQueryAction.java:273)
     at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:836)
     at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:270)
     at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:110)
     at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
     at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
     at org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
     at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1395)
     at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1384)
     at cayenne.TryStuff.go(TryStuff.java:60)
     at cayenne.TryStuff.main(TryStuff.java:100)
Caused by: java.lang.IllegalArgumentException: No inheritance - there must be only one override
set
     at org.apache.cayenne.access.jdbc.DataRowPostProcessor.<init>(DataRowPostProcessor.java:126)
     at org.apache.cayenne.access.jdbc.DataRowPostProcessor.createPostProcessor(DataRowPostProcessor.java:113)
     at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:84)
     at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:59)
     at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:273)
     ... 13 more

What am I doing wrong?

tx

Hans

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:


Mime
View raw message