Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 19062 invoked from network); 9 Sep 2009 13:42:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Sep 2009 13:42:33 -0000 Received: (qmail 63999 invoked by uid 500); 9 Sep 2009 13:42:32 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 63977 invoked by uid 500); 9 Sep 2009 13:42:32 -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 63895 invoked by uid 99); 9 Sep 2009 13:42:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Sep 2009 13:42:32 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.149.77] (HELO na3sys009aog106.obsmtp.com) (74.125.149.77) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 09 Sep 2009 13:42:21 +0000 Received: from source ([209.85.221.192]) by na3sys009aob106.postini.com ([74.125.148.12]) with SMTP ID DSNKSqewp0IzzdKPMiaV3WP3WL54P8GHmQq2@postini.com; Wed, 09 Sep 2009 06:42:01 PDT Received: by mail-qy0-f192.google.com with SMTP id 30so3567066qyk.5 for ; Wed, 09 Sep 2009 06:41:59 -0700 (PDT) Received: by 10.224.93.74 with SMTP id u10mr121513qam.327.1252503719829; Wed, 09 Sep 2009 06:41:59 -0700 (PDT) Received: from ?200.190.12.96? ([212.51.168.10]) by mx.google.com with ESMTPS id 21sm599154ywh.5.2009.09.09.06.41.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 09 Sep 2009 06:41:59 -0700 (PDT) Message-ID: <4AA7B0A5.7040408@smausa.com> Date: Wed, 09 Sep 2009 15:41:57 +0200 From: "lmarchal@smausa.com" User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: user@cayenne.apache.org Subject: Cayenne does not find object in his graph after SelectQuery. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello everybody, I have a strange problem, that is difficult to reproduce so I would like to gather information about the cayenne internals. In my database I have an object JOB that has ID, NAME, PRIORITY as PKs. I have a method getJobByID(ID, NAME) that returns the unique job without specifying the PRIORITY PK using a SelectQuery. The main problem is when I use the 'getJobByID(ID, NAME)' Cayenne do the database request, but the job does not seems to be refreshed in the cayenne cache (object graph). If I make the request using the ObjectID, the job is refreshed. The only differences is that using the ObjectID Cayenne specifies the PRIORITY field. Both requests returns the same job (cause PRIORITY is never used and always 0), but cayenne seems to not find it in his object graph. The question is : is it possible that Cayenne does not find back this job in his object graph because I do not specify the PRIORITY PK in my request ? or this can be a bug ? This behavior should be strange cause cayenne should always update the job in his graph... I do not use any caching system. Thanks. Laurent Marchal. ----- public static DailyJob getById(ObjectContext context, IDailyJobKey key) { HashMap ExpressionMap = new HashMap(2); ExpressionMap.put(DailyJob.ID_PROPERTY, key.getId()); ExpressionMap.put(DailyJob.JOB_NAME_PROPERTY, key.getJobName()); Expression expr = ExpressionFactory.matchAllExp(ExpressionMap, Expression.EQUAL_TO); SelectQuery qGetJob = new SelectQuery(DailyJob.class, expr); qGetJob.setFetchLimit(1); if (job != null && job.size() > 0) { return job.get(0); } return null; }