[
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.
> * <br>
> * 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 <T> Predicate example(From<?, T> expression, T example,
> ComparisonStyle style,
> <Attribute<? super T,?>>... 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.