Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 26604 invoked from network); 1 Aug 2009 16:05:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Aug 2009 16:05:36 -0000 Received: (qmail 71680 invoked by uid 500); 1 Aug 2009 16:05:40 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 71613 invoked by uid 500); 1 Aug 2009 16:05:40 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 71603 invoked by uid 99); 1 Aug 2009 16:05:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Aug 2009 16:05:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Aug 2009 16:05:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id B0B14234C1F0 for ; Sat, 1 Aug 2009 09:05:17 -0700 (PDT) Message-ID: <1608388403.1249142717722.JavaMail.jira@brutus> Date: Sat, 1 Aug 2009 09:05:17 -0700 (PDT) From: "Pinaki Poddar (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (OPENJPA-1198) Query by Example In-Reply-To: <505674440.1248712094847.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pinaki Poddar resolved OPENJPA-1198. ------------------------------------ Resolution: Fixed > Query by Example > ---------------- > > Key: OPENJPA-1198 > URL: https://issues.apache.org/jira/browse/OPENJPA-1198 > Project: OpenJPA > Issue Type: New Feature > Components: query > Affects Versions: 2.0.0 > Reporter: Pinaki Poddar > Assignee: Pinaki Poddar > Fix For: 2.0.0 > > > I am planning to add a new query by example feature to Criteria Query API. > The proposed new method will appear in CriteriaBuilder to create a predicate. > Comments welcome (see below for further details). > /** > * Create a predicate based upon the attribute values of a given > * "example" entity instance. The predicate is the conjunction > * or disjunction of predicates for subset of attribute of the entity. > *
> * By default, all the singular entity attributes (the basic, embedded > * and uni-cardinality relations) that have a non-null or non-default > * value for the example instance and are not an identity or version > * attribute are included. The comparable attributes can be further > * pruned by specifying variable list of attributes as the final argument. > * > * @param example an instance of an entity class > * @param style specifies various aspects of comparison such as whether > * non-null attribute values be included, how string-valued attribute be > * compared, whether the individual attribute based predicates are ANDed > * or ORed etc. > * > * @return a predicate > */ > public Predicate example(From expression, T example, ComparisonStyle style, > >... excludes) ; > ======================================================================== > The limitation is that the style is 'global' i.e. applies to all attributes. If we want to tune comparison style > per attribute, the API gets somewhat more cumbersome to use. Ideas are welcome. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.