Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45A6996D9 for ; Thu, 27 Oct 2011 06:47:56 +0000 (UTC) Received: (qmail 84772 invoked by uid 500); 27 Oct 2011 06:47:55 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 84765 invoked by uid 500); 27 Oct 2011 06:47:53 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 84751 invoked by uid 99); 27 Oct 2011 06:47:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2011 06:47:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of marcin@ish.com.au designates 59.167.240.32 as permitted sender) Received: from [59.167.240.32] (HELO fish.ish.com.au) (59.167.240.32) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Oct 2011 06:47:44 +0000 Received: from [10.242.2.10] (port=51879 helo=jablko.local) by fish.ish.com.au with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76) (envelope-from ) id 1RJJkG-0006Pp-09 for user@cayenne.apache.org; Thu, 27 Oct 2011 17:47:20 +1100 X-CTCH-RefID: str=0001.0A150203.4EA8FE78.010B,ss=1,re=0.000,fgs=0 Message-ID: <4EA8FE75.2000606@ish.com.au> Date: Thu, 27 Oct 2011 16:47:17 +1000 From: Marcin Skladaniec User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Re: problem with ROP query performance References: <4EA10F89.3040000@ish.com.au> <3A8423E9-C298-477B-A2E4-335E9E60CDE8@objectstyle.org> In-Reply-To: <3A8423E9-C298-477B-A2E4-335E9E60CDE8@objectstyle.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I will Jira it, just will try to be more specific and include some code or maybe unit test. Thanks Marcin PS: using cayenne 3.1m2 On 27/10/11 5:22 AM, Andrus Adamchik wrote: > Yeah sounds odd. It fetches paintings of that artist. Maybe we can jira that and take a closer look? > > On a side note, I noticed that due to the weak references used in the DataContext to store committed objects, you may see lots of faulting of objects that were fetched in the same context just a few seconds ago. This is probably completely unrelated, and for that we are experimenting with using soft references (instead of weak) via a new ObjectMapRetainStrategy (available in 3.1M3). > > Andrus > > > On Oct 21, 2011, at 9:22 AM, Marcin Skladaniec wrote: > >> 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 = >> DEBUG - RelationshipQuery:paintings for: >> >> 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 >> >>