Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 19818 invoked from network); 21 Apr 2009 11:00:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Apr 2009 11:00:06 -0000 Received: (qmail 63153 invoked by uid 500); 21 Apr 2009 11:00:05 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 63116 invoked by uid 500); 21 Apr 2009 11:00:05 -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 63106 invoked by uid 99); 21 Apr 2009 11:00:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 11:00:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 21 Apr 2009 10:59:59 +0000 Received: (qmail 2068 invoked from network); 21 Apr 2009 10:58:40 -0000 Received: from unknown (HELO ?IPv6:::1?) (127.0.0.1) by localhost with SMTP; 21 Apr 2009 10:58:40 -0000 Message-Id: From: Andrus Adamchik To: user@cayenne.apache.org In-Reply-To: <1240311040.12521.50.camel@nick-ubudesktop> Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: Question about Caching. Date: Tue, 21 Apr 2009 13:58:39 +0300 References: <1240306136.12521.1.camel@nick-ubudesktop> <1240311040.12521.50.camel@nick-ubudesktop> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Yes, this is normal. Altering parameters changes the query, so in two =20= case you end up with two different queries behind the scenes, each =20 cached separately. Andrus On Apr 21, 2009, at 1:50 PM, Nikos Paraschou wrote: > =CE=A3=CF=84=CE=B9=CF=82 21-04-2009, =CE=B7=CE=BC=CE=AD=CF=81=CE=B1 = =CE=A4=CF=81=CE=B9, =CE=BA=CE=B1=CE=B9 =CF=8E=CF=81=CE=B1 13:21 +0300, = =CE=BF/=20 > =CE=B7 Andrus Adamchik > =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: >>> Shouldn't it first look in cache? >> >> >> Yes it should. Are you using the same set of parameters in both =20 >> cases? > > In the first case I am just calling the query "selectVehicles" which =20= > is > stored in DataMap without defining any parameters. All vehicles are > returned. > > In the second case I want to retrieve a specific vehicle so I define =20= > the > parameter plate > > params.put("plate", "koz-6657") and call > > performQuery("selectVehicles", params, false); > > The second call doesn't retrieve the requested vehicle from the cache > but instead, it sends a query to the DB. > > Why is this happening? Is it normal? > > >> And also which version of Cayenne is this? > > I am using Cayenne 2.0.4. > >> >> Andrus >> >> >> On Apr 21, 2009, at 12:28 PM, Nikos Paraschou wrote: >> >>> Hello, >>> >>> I created an Object Select Query in the Modeller which selects * =20 >>> from >>> table Vehicles. The query has a qualifier (plate =3D $plate). In =20 >>> Result >>> Caching I selected Shared Cache and unchecked the checkbox Refresh >>> Results. >>> >>> I wrote the following code: >>> >>> Map params =3D new HashMap(); >>> params.put("plate", "koz-6657"); >>> >>> List allVehicles =3D context.performQuery("selectVehicles", >>> false); >>> List specificVehicle =3D = context.performQuery("selectVehicles", >>> params, false); >>> >>> I noticed that the first call of performQuery stores the retrieved >>> Vehicle Objects in cache. >>> But the second call, instead of getting the specific vehicle from >>> cache >>> it sends a query to the database. >>> >>> Why is this happening? Shouldn't it first look in cache? >>> >>> Thank you, >>> Nikos Paraschou >>> >>> >> > >