cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Skladaniec <mar...@ish.com.au>
Subject problem with ROP query performance
Date Fri, 21 Oct 2011 06:22:01 GMT
Hi

There is a discrepancy in behaviour of performQuery between ROP and 
non-ROP setup.

lets consider this simple code:

         DataContext newContext = ...

         Artist artist = newContext.newObject(Artist.class);
         newContext.commitChanges();

         Painting painting = newContext.newObject(Painting.class);
         painting.setArtist(artist);

         assertEquals(artist.getPersistenceState(), 
PersistenceState.MODIFIED); // this is true

         SelectQuery sq = new SelectQuery(Painting.class, 
ExpressionFactory.matchExp(Painting.ARTIST_PROPERTY, artist));

         newContext.performQuery(sq);


I have added some logging to the performQuery() to check what happens. 
This is what I see in ROP setup:

DEBUG - select query for Painting with qualifier: artist = 
<ObjectId:Artist, id=200>
DEBUG - RelationshipQuery:paintings for: <ObjectId:Artist, id=200>

Seems straightforward, select query is executed... but then cayenne 
faults the Artist object and its relationships. This would be ok, but 
the Artist object is already in the context, no trip to the databse 
required!

Same code in non-ROP setup does not behave teh same - the 
RelatioshipQuery is not executed (unless artist.getPaintings() is called 
explicitly).

For us this Relationship Query is a big big performance problem.
Is that a bug in ROP? Is there a way to prevent faulting of the relatioship?

With regards
Marcin


Mime
View raw message