From a291185ad83f3961c5d27b597404461ba00e4030 Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Tue, 1 Sep 2009 21:07:19 +0000 Subject: [PATCH] OPENJPA-1278: missing file git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@810240 13f79535-47bb-0310-9956-ffa450edef68 --- .../criteria/OpenJPACriteriaBuilder.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/OpenJPACriteriaBuilder.java diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/OpenJPACriteriaBuilder.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/OpenJPACriteriaBuilder.java new file mode 100644 index 000000000..bed4e2178 --- /dev/null +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/OpenJPACriteriaBuilder.java @@ -0,0 +1,61 @@ +package org.apache.openjpa.persistence.criteria; + +import javax.persistence.criteria.From; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.QueryBuilder; +import javax.persistence.metamodel.Attribute; + +/** + * OpenJPA-specific extension to JPA 2.0 Criteria Query Builder API. + * + * + * @author Pinaki Poddar + * @since 2.0.0 + */ +public interface OpenJPACriteriaBuilder extends QueryBuilder { + /** + * 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. + *
+ * 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 for exclusion. + * + * @param example a non-null instance of a persistent entity. + * + * @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. Can be null to designate default comparison style. + * + * @param excludes list of attributes that are excluded from comparison. + * Can be null. + * + * @return a predicate + */ + public Predicate qbe(From from, T example, ComparisonStyle style, Attribute... excludes); + + /** + * Overloaded with no extra attribute to exclude. + */ + public Predicate qbe(From from, T example, ComparisonStyle style); + + /** + * Overloaded with default comparison style. + */ + public Predicate qbe(From from, T example, Attribute... excludes); + + /** + * Overloaded with default comparison style and no extra attribute to exclude. + */ + public Predicate qbe(From from, T example); + + /** + * Create a mutable style to apply on query-by-example. + */ + public ComparisonStyle qbeStyle(); + +}