Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 61901 invoked from network); 3 Mar 2010 15:34:34 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Mar 2010 15:34:34 -0000 Received: (qmail 15008 invoked by uid 500); 3 Mar 2010 15:34:26 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 14971 invoked by uid 500); 3 Mar 2010 15:34:26 -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 14962 invoked by uid 99); 3 Mar 2010 15:34:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 15:34:26 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.219.216] (HELO mail-ew0-f216.google.com) (209.85.219.216) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Mar 2010 15:34:18 +0000 Received: by ewy8 with SMTP id 8so907352ewy.12 for ; Wed, 03 Mar 2010 07:33:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.172.76 with SMTP id s54mr347904wel.100.1267630437225; Wed, 03 Mar 2010 07:33:57 -0800 (PST) In-Reply-To: <1267590612136-425390.post@n3.nabble.com> References: <1267503545328-423239.post@n3.nabble.com> <00D55FC8-9F14-4653-BA6D-FD8B42237FAF@objectstyle.org> <1267590612136-425390.post@n3.nabble.com> From: Michael Gentry Date: Wed, 3 Mar 2010 10:33:37 -0500 Message-ID: <5adb61291003030733r68b47ccepaf4ca0259571ab59@mail.gmail.com> Subject: Re: Direct mapping between Named query and Pojo To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Mar 2, 2010 at 11:30 PM, Sudheer wrote: > Assume that named query is on more than one table and has columns from more > than one table. In this case we may not be having dataobject defined stright > from tables. So can I create a dataobject that just maps to named query? A DataObject needs to be associated with a single table. Of course, it can have relationships to other tables. If you really need to have a DataObject associated with multiple tables and your database supports views, then you can create a view that you map to your DataObject. > If my query is fixed, I will keep it in datamap and pass the runtime > parameter values. But I am more interested in dynamic where condition > constructed on existing named query. For e.g. Take a case of filter on list > of objects (as mentioned above, object contains columns from mutiple > tables). After user keys in the filter criteria, I need to constrict a > dynamic where condition and link to existing named query. I'm not sure if this really answers your question, but Cayenne by default will omit (thereby widening the search) portions of the query that are missing. If you have: firstName = $firstName and lastName = $lastName and you only provide the query with the $lastName substitution parameter, then Cayenne drops the firstName = $firstName part of the query for you. mrg