Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 48A17200B80 for ; Wed, 14 Sep 2016 23:01:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 47308160AB4; Wed, 14 Sep 2016 21:01:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8E393160AB3 for ; Wed, 14 Sep 2016 23:01:30 +0200 (CEST) Received: (qmail 53142 invoked by uid 500); 14 Sep 2016 21:01:29 -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 53129 invoked by uid 99); 14 Sep 2016 21:01:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Sep 2016 21:01:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id F373B1A52D7 for ; Wed, 14 Sep 2016 21:01:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 9eEWAFS8YkQj for ; Wed, 14 Sep 2016 21:01:26 +0000 (UTC) Received: from mail-qt0-f178.google.com (mail-qt0-f178.google.com [209.85.216.178]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 2C6705F22E for ; Wed, 14 Sep 2016 21:01:26 +0000 (UTC) Received: by mail-qt0-f178.google.com with SMTP id l91so13824961qte.3 for ; Wed, 14 Sep 2016 14:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=AKVosi6WB1g0Jug36h39K9XDK3+D5ksbZB5dXBQzMjA=; b=qzvPwiXxHT2SZvu352huOcLBcGqOU7AzIFSi99IM1TRHgcLuNhKUs4m+F9wm4EujG7 lsITfXKFQCtJyKBoa2vDJg5XFMZ1Ef/Ljpfm2LM8KKGaPA7LTGmq3yTv++SgyJ6kjXe+ wqK0xDb9CPjHJ8R1Cuqir9k7ubFsPsnJaTFjxDatAXtyHGLnDnPgm7LKUZ6wq9b2JFT+ +r5JBT8ec5geuzuM+dEFW3GRc/1ntZMAGuqwa1VJbQ5GF7g5o84jTZE1HRZ4n3FrsGtU l+P23MsGNDikHN1Rh6kZr6BSTKYGTERiX7QTq5KnTHamnuDLx/8e5Z1k8/51Gbcg4JmJ Rltg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=AKVosi6WB1g0Jug36h39K9XDK3+D5ksbZB5dXBQzMjA=; b=bvyjJ6SMvhDl4dEugNV7WlSy8r5PHUvly4GTrSe8o5/tYMg093PFGT4MrcXdH9OMYJ N+yubcjKd7Hhcgsk49ymYBVS+z3TYg1dId1LzdRFziQH+HpuFb7POWCilhpGHGY9jM0a QiOckcU3XeJ7T5vHlkSu+PXvUSetOM/TVqbQQR5UOd+Gb7rm+jHdWJx20cJYnC0945zv ihQHkX0LqFV30DGuis7z0n7D+NF8OxHjsgMXWffqM7tSCkqv5givSEZgD7mbwGWXVdmV u3ONp2atQ3oXX2CBjsr0ZSw0+W5I/6lgppTxp34sX6KNPmLXXbA7XiuGhOEtdpDRO6tj VOgQ== X-Gm-Message-State: AE9vXwMWv1ZyEZygiYmTLuhLG2kiNAsZ4aQGREu6n92KHymfx+yBjIfUDHMZEn45aCvwv65MiV43XRqFDZ0/wQ== X-Received: by 10.200.52.124 with SMTP id v57mr5570949qtb.137.1473886878569; Wed, 14 Sep 2016 14:01:18 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: John Huss Date: Wed, 14 Sep 2016 21:01:07 +0000 Message-ID: Subject: Re: Fetching a list of objects from a list of primary keys To: "user@cayenne.apache.org" Content-Type: multipart/alternative; boundary=001a113ad820d62323053c7e0722 archived-at: Wed, 14 Sep 2016 21:01:31 -0000 --001a113ad820d62323053c7e0722 Content-Type: text/plain; charset=UTF-8 You can use ExpressionFactory.matchDbExp("pk1", val1).and(ExpressionFactory.matchDbExp("pk2", val2)) Then assemble the resulting AND expressions into a list of OR expressions using ExpressionFactory.or() pk1 = val1 AND pk2 = val2 OR pk1 = val3 AND pk2 = val4 OR pk1 = val5 AND pk2 = val6 On Wed, Sep 14, 2016 at 3:41 PM Oksana Peterburgskaya < oksana.Peterburgskaya@amphorainc.com> wrote: > Hello, > I'm currently working on a case related to this post where I try to fetch > a list of objects based on a list of primary keys. The difference for me is > that the primary key consists of multiple fields id db. If I try to use > ObjectForPK(), it accepts such multi-park PKs. However, if I try to put > multiple multip-part PK in input maps for ObjectForPK(), ObjectForPK() but > only returns the first object, not all of them. > > I can't really user ExpressionFactory.InDBExp() the way it is suggested in > the post. Are there any other solutions? I really need to do get all > objects in one query otherwise we are hit with db-related performance > issues. > > Thank you very much, > Oksana Peterburgskaya > > > http://grokbase.com/t/cayenne/user/164cdjb5ts/fetching-a-list-of-objects-from-a-list-of-primary-keys > Confidentiality Notice: This e-mail and accompanying documents contain > confidential information intended for a specific individual and purpose. > This e-mailed information is private and protected by law. If you are not > the intended recipient, you are hereby notified that any disclosure, > copying, or distribution, or the taking of any action based on the contents > of this information, is strictly prohibited. > --001a113ad820d62323053c7e0722--