[hibernate-commits] Hibernate SVN: r17251 - in core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria: expression and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Aug 7 08:12:21 EDT 2009


Author: steve.ebersole at jboss.com
Date: 2009-08-07 08:12:20 -0400 (Fri, 07 Aug 2009)
New Revision: 17251

Added:
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryArithmeticOperation.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryOperatorExpression.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SubqueryComparisonModifierExpression.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryArithmeticOperation.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryOperatorExpression.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AbsFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentDateFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimeFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimestampFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LengthFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LocateFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LowerFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SqrtFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SubstringFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/TrimFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/UpperFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/LikePredicate.java
Modified:
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryBuilderImpl.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AggregationFunction.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/BasicFunctionExpression.java
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/FunctionExpression.java
Log:
EJB-447 : Implement JPA 2.0 criteria apis (completed function support)

Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryBuilderImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryBuilderImpl.java	2009-08-06 18:39:33 UTC (rev 17250)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/QueryBuilderImpl.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -41,10 +41,25 @@
 import javax.persistence.Tuple;
 
 import org.hibernate.ejb.EntityManagerFactoryImpl;
+import org.hibernate.ejb.criteria.expression.BinaryArithmeticOperation;
 import org.hibernate.ejb.criteria.expression.CompoundSelectionImpl;
 import org.hibernate.ejb.criteria.expression.ParameterExpressionImpl;
 import org.hibernate.ejb.criteria.expression.LiteralExpression;
+import org.hibernate.ejb.criteria.expression.SubqueryComparisonModifierExpression;
+import org.hibernate.ejb.criteria.expression.UnaryArithmeticOperation;
+import org.hibernate.ejb.criteria.expression.function.AbsFunction;
 import org.hibernate.ejb.criteria.expression.function.AggregationFunction;
+import org.hibernate.ejb.criteria.expression.function.BasicFunctionExpression;
+import org.hibernate.ejb.criteria.expression.function.CurrentDateFunction;
+import org.hibernate.ejb.criteria.expression.function.CurrentTimeFunction;
+import org.hibernate.ejb.criteria.expression.function.CurrentTimestampFunction;
+import org.hibernate.ejb.criteria.expression.function.LengthFunction;
+import org.hibernate.ejb.criteria.expression.function.LocateFunction;
+import org.hibernate.ejb.criteria.expression.function.LowerFunction;
+import org.hibernate.ejb.criteria.expression.function.SqrtFunction;
+import org.hibernate.ejb.criteria.expression.function.SubstringFunction;
+import org.hibernate.ejb.criteria.expression.function.TrimFunction;
+import org.hibernate.ejb.criteria.expression.function.UpperFunction;
 import org.hibernate.ejb.criteria.predicate.BooleanExpressionPredicate;
 import org.hibernate.ejb.criteria.predicate.ExplicitTruthValueCheck;
 import org.hibernate.ejb.criteria.predicate.TruthValue;
@@ -53,6 +68,7 @@
 import org.hibernate.ejb.criteria.predicate.ComparisonPredicate;
 import org.hibernate.ejb.criteria.predicate.InPredicate;
 import org.hibernate.ejb.criteria.predicate.BetweenPredicate;
+import org.hibernate.ejb.criteria.predicate.LikePredicate;
 import static org.hibernate.ejb.criteria.predicate.ComparisonPredicate.ComparisonOperator;
 
 /**
@@ -519,7 +535,55 @@
 		return new InPredicate<T>( this, expression, values );
 	}
 
+	public Predicate like(Expression<String> matchExpression, Expression<String> pattern) {
+		return new LikePredicate( this, matchExpression, pattern );
+	}
 
+	public Predicate like(Expression<String> matchExpression, Expression<String> pattern, Expression<Character> escapeCharacter) {
+		return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
+	}
+
+	public Predicate like(Expression<String> matchExpression, Expression<String> pattern, char escapeCharacter) {
+		return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
+	}
+
+	public Predicate like(Expression<String> matchExpression, String pattern) {
+		return new LikePredicate( this, matchExpression, pattern );
+	}
+
+	public Predicate like(Expression<String> matchExpression, String pattern, Expression<Character> escapeCharacter) {
+		return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
+	}
+
+	public Predicate like(Expression<String> matchExpression, String pattern, char escapeCharacter) {
+		return new LikePredicate( this, matchExpression, pattern, escapeCharacter );
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern) {
+		return like( matchExpression, pattern ).negate();
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern, Expression<Character> escapeCharacter) {
+		return like( matchExpression, pattern, escapeCharacter ).negate();
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, Expression<String> pattern, char escapeCharacter) {
+		return like( matchExpression, pattern, escapeCharacter ).negate();
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, String pattern) {
+		return like( matchExpression, pattern ).negate();
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, String pattern, Expression<Character> escapeCharacter) {
+		return like( matchExpression, pattern, escapeCharacter ).negate();
+	}
+
+	public Predicate notLike(Expression<String> matchExpression, String pattern, char escapeCharacter) {
+		return like( matchExpression, pattern, escapeCharacter ).negate();
+	}
+
+
 	// parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 	/**
@@ -603,307 +667,459 @@
 	}
 
 
+	// other functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-	public Predicate exists(Subquery<?> subquery) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <T> Expression<T> function(String name, Class<T> returnType, Expression<?>... arguments) {
+		return new BasicFunctionExpression<T>( this, returnType, name, arguments );
 	}
 
-	public <Y> Expression<Y> all(Subquery<Y> ySubquery) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> abs(Expression<N> expression) {
+		return new AbsFunction<N>( this, expression );
 	}
 
-	public <Y> Expression<Y> some(Subquery<Y> ySubquery) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Double> sqrt(Expression<? extends Number> expression) {
+		return new SqrtFunction( this, expression );
 	}
 
-	public <Y> Expression<Y> any(Subquery<Y> ySubquery) {
-		return null;
+	public Expression<java.sql.Date> currentDate() {
+		return new CurrentDateFunction( this );
 	}
 
-	public <N extends Number> Expression<N> neg(Expression<N> nExpression) {
-		return null;
+	public Expression<java.sql.Timestamp> currentTimestamp() {
+		return new CurrentTimestampFunction( this );
 	}
 
-	public <N extends Number> Expression<N> abs(Expression<N> nExpression) {
-		return null;
+	public Expression<java.sql.Time> currentTime() {
+		return new CurrentTimeFunction( this );
 	}
 
-	public <N extends Number> Expression<N> sum(Expression<? extends N> expression, Expression<? extends N> expression1) {
-		return null;
+	public Expression<String> substring(Expression<String> value, Expression<Integer> start) {
+		return new SubstringFunction( this, value, start );
 	}
 
-	public <N extends Number> Expression<N> prod(Expression<? extends N> expression, Expression<? extends N> expression1) {
-		return null;
+	public Expression<String> substring(Expression<String> value, int start) {
+		return new SubstringFunction( this, value, start );
 	}
 
-	public <N extends Number> Expression<N> diff(Expression<? extends N> expression, Expression<? extends N> expression1) {
-		return null;
+	public Expression<String> substring(Expression<String> value, Expression<Integer> start, Expression<Integer> length) {
+		return new SubstringFunction( this, value, start, length );
 	}
 
-	public <N extends Number> Expression<N> sum(Expression<? extends N> expression, N n) {
-		return null;
+	public Expression<String> substring(Expression<String> value, int start, int length) {
+		return new SubstringFunction( this, value, start, length );
 	}
 
-	public <N extends Number> Expression<N> prod(Expression<? extends N> expression, N n) {
-		return null;
+	public Expression<String> trim(Expression<String> trimSource ) {
+		return new TrimFunction( this, trimSource );
 	}
 
-	public <N extends Number> Expression<N> diff(Expression<? extends N> expression, N n) {
-		return null;
+	public Expression<String> trim(Trimspec trimspec, Expression<String> trimSource) {
+		return new TrimFunction( this, trimspec, trimSource );
 	}
 
-	public <N extends Number> Expression<N> sum(N n, Expression<? extends N> expression) {
-		return null;
+	public Expression<String> trim(Expression<Character> trimCharacter, Expression<String> trimSource) {
+		return new TrimFunction( this, trimCharacter, trimSource );
 	}
 
-	public <N extends Number> Expression<N> prod(N n, Expression<? extends N> expression) {
-		return null;
+	public Expression<String> trim(Trimspec trimspec, Expression<Character> trimCharacter, Expression<String> trimSource) {
+		return new TrimFunction( this, trimspec, trimCharacter, trimSource );
 	}
 
-	public <N extends Number> Expression<N> diff(N n, Expression<? extends N> expression) {
-		return null;
+	public Expression<String> trim(char trimCharacter, Expression<String> trimSource) {
+		return new TrimFunction( this, trimCharacter, trimSource );
 	}
 
-	public Expression<Number> quot(Expression<? extends Number> expression, Expression<? extends Number> expression1) {
-		return null;
+	public Expression<String> trim(Trimspec trimspec, char trimCharacter, Expression<String> trimSource) {
+		return new TrimFunction( this, trimspec, trimCharacter, trimSource );
 	}
 
-	public Expression<Number> quot(Expression<? extends Number> expression, Number number) {
-		return null;
+	public Expression<String> lower(Expression<String> value) {
+		return new LowerFunction( this, value );
 	}
 
-	public Expression<Number> quot(Number number, Expression<? extends Number> expression) {
-		return null;
+	public Expression<String> upper(Expression<String> value) {
+		return new UpperFunction( this, value );
 	}
 
-	public Expression<Integer> mod(Expression<Integer> integerExpression, Expression<Integer> integerExpression1) {
-		return null;
+	public Expression<Integer> length(Expression<String> value) {
+		return new LengthFunction( this, value );
 	}
 
-	public Expression<Integer> mod(Expression<Integer> integerExpression, Integer integer) {
-		return null;
+	public Expression<Integer> locate(Expression<String> string, Expression<String> pattern) {
+		return new LocateFunction( this, pattern, string );
 	}
 
-	public Expression<Integer> mod(Integer integer, Expression<Integer> integerExpression) {
-		return null;
+	public Expression<Integer> locate(Expression<String> string, Expression<String> pattern, Expression<Integer> start) {
+		return new LocateFunction( this, pattern, string, start );
 	}
 
-	public Expression<Double> sqrt(Expression<? extends Number> expression) {
-		return null;
+	public Expression<Integer> locate(Expression<String> string, String pattern) {
+		return new LocateFunction( this, pattern, string );
 	}
 
-	public Expression<Long> toLong(Expression<? extends Number> expression) {
-		return null;
+	public Expression<Integer> locate(Expression<String> string, String pattern, int start) {
+		return new LocateFunction( this, pattern, string, start );
 	}
 
-	public Expression<Integer> toInteger(Expression<? extends Number> expression) {
-		return null;
-	}
 
-	public Expression<Float> toFloat(Expression<? extends Number> expression) {
-		return null;
-	}
+	// arithmetic operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	public Expression<Double> toDouble(Expression<? extends Number> expression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> neg(Expression<N> expression) {
+		return new UnaryArithmeticOperation<N>(
+				this,
+				UnaryArithmeticOperation.Operation.UNARY_MINUS,
+				expression
+		);
 	}
 
-	public Expression<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> sum(Expression<? extends N> expression1, Expression<? extends N> expression2) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression1.getJavaType(),
+				BinaryArithmeticOperation.Operation.ADD,
+				expression1,
+				expression2
+		);
 	}
 
-	public Expression<BigInteger> toBigInteger(Expression<? extends Number> expression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> prod(Expression<? extends N> expression1, Expression<? extends N> expression2) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression1.getJavaType(),
+				BinaryArithmeticOperation.Operation.MULTIPLY,
+				expression1,
+				expression2
+		);
 	}
 
-	public Expression<String> toString(Expression<Character> characterExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> diff(Expression<? extends N> expression1, Expression<? extends N> expression2) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression1.getJavaType(),
+				BinaryArithmeticOperation.Operation.SUBTRACT,
+				expression1,
+				expression2
+		);
 	}
 
-	public <C extends Collection<?>> Predicate isEmpty(Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> sum(Expression<? extends N> expression, N n) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.ADD,
+				expression,
+				n
+		);
 	}
 
-	public <C extends Collection<?>> Predicate isNotEmpty(Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> prod(Expression<? extends N> expression, N n) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.MULTIPLY,
+				expression,
+				n
+		);
 	}
 
-	public <C extends Collection<?>> Expression<Integer> size(C c) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> diff(Expression<? extends N> expression, N n) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.SUBTRACT,
+				expression,
+				n
+		);
 	}
 
-	public <C extends Collection<?>> Expression<Integer> size(Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> sum(N n, Expression<? extends N> expression) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.ADD,
+				n,
+				expression
+		);
 	}
 
-	public <E, C extends Collection<E>> Predicate isMember(E e, Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> prod(N n, Expression<? extends N> expression) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.MULTIPLY,
+				n,
+				expression
+		);
 	}
 
-	public <E, C extends Collection<E>> Predicate isNotMember(E e, Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <N extends Number> Expression<N> diff(N n, Expression<? extends N> expression) {
+		return new BinaryArithmeticOperation<N>(
+				this,
+				(Class<N>) expression.getJavaType(),
+				BinaryArithmeticOperation.Operation.SUBTRACT,
+				n,
+				expression
+		);
 	}
 
-	public <E, C extends Collection<E>> Predicate isMember(Expression<E> eExpression, Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Number> quot(Expression<? extends Number> expression1, Expression<? extends Number> expression2) {
+		// TODO : still open question whether this should be a quotient (integer division) or division
+		throw new UnsupportedOperationException( "Not yet implemented!" );
 	}
 
-	public <E, C extends Collection<E>> Predicate isNotMember(Expression<E> eExpression, Expression<C> cExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Number> quot(Expression<? extends Number> expression, Number number) {
+		// TODO : still open question whether this should be a quotient (integer division) or division
+		throw new UnsupportedOperationException( "Not yet implemented!" );
 	}
 
-	public <V, M extends Map<?, V>> Expression<Collection<V>> values(M map) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Number> quot(Number number, Expression<? extends Number> expression) {
+		// TODO : still open question whether this should be a quotient (integer division) or division
+		throw new UnsupportedOperationException( "Not yet implemented!" );
 	}
 
-	public <K, M extends Map<K, ?>> Expression<Set<K>> keys(M m) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Integer> mod(Expression<Integer> expression1, Expression<Integer> expression2) {
+		return new BinaryArithmeticOperation<Integer>(
+				this,
+				Integer.class,
+				BinaryArithmeticOperation.Operation.MOD,
+				expression1,
+				expression2
+		);
 	}
 
-	public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Integer> mod(Expression<Integer> expression, Integer integer) {
+		return new BinaryArithmeticOperation<Integer>(
+				this,
+				Integer.class,
+				BinaryArithmeticOperation.Operation.MOD,
+				expression,
+				integer
+		);
 	}
 
-	public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Character> characterExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Integer> mod(Integer integer, Expression<Integer> expression) {
+		return new BinaryArithmeticOperation<Integer>(
+				this,
+				Integer.class,
+				BinaryArithmeticOperation.Operation.MOD,
+				integer,
+				expression
+		);
 	}
 
-	public Predicate like(Expression<String> stringExpression, Expression<String> stringExpression1, char c) {
-		return null;
-	}
 
-	public Predicate like(Expression<String> stringExpression, String s) {
-		return null;
-	}
+	// casting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	public Predicate like(Expression<String> stringExpression, String s, Expression<Character> characterExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Long> toLong(Expression<? extends Number> expression) {
+		return expression.as( Long.class );
 	}
 
-	public Predicate like(Expression<String> stringExpression, String s, char c) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Integer> toInteger(Expression<? extends Number> expression) {
+		return expression.as( Integer.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Float> toFloat(Expression<? extends Number> expression) {
+		return expression.as( Float.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Character> characterExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<Double> toDouble(Expression<? extends Number> expression) {
+		return expression.as( Double.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, Expression<String> stringExpression1, char c) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<BigDecimal> toBigDecimal(Expression<? extends Number> expression) {
+		return expression.as( BigDecimal.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, String s) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<BigInteger> toBigInteger(Expression<? extends Number> expression) {
+		return expression.as( BigInteger.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, String s, Expression<Character> characterExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public Expression<String> toString(Expression<Character> characterExpression) {
+		return characterExpression.as( String.class );
 	}
 
-	public Predicate notLike(Expression<String> stringExpression, String s, char c) {
-		return null;
-	}
 
-	public Expression<String> concat(Expression<String> stringExpression, Expression<String> stringExpression1) {
-		return null;
-	}
+	// subqueries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	public Expression<String> concat(Expression<String> stringExpression, String s) {
+	/**
+	 * {@inheritDoc}
+	 */
+	public Predicate exists(Subquery<?> subquery) {
 		return null;
 	}
 
-	public Expression<String> concat(String s, Expression<String> stringExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <Y> Expression<Y> all(Subquery<Y> subquery) {
+		return new SubqueryComparisonModifierExpression<Y>(
+				this,
+				subquery.getJavaType(),
+				subquery,
+				SubqueryComparisonModifierExpression.Modifier.ALL
+		);
 	}
 
-	public Expression<String> substring(Expression<String> stringExpression, Expression<Integer> integerExpression) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <Y> Expression<Y> some(Subquery<Y> subquery) {
+		return new SubqueryComparisonModifierExpression<Y>(
+				this,
+				subquery.getJavaType(),
+				subquery,
+				SubqueryComparisonModifierExpression.Modifier.SOME
+		);
 	}
 
-	public Expression<String> substring(Expression<String> stringExpression, int i) {
-		return null;
+	/**
+	 * {@inheritDoc}
+	 */
+	public <Y> Expression<Y> any(Subquery<Y> subquery) {
+		return new SubqueryComparisonModifierExpression<Y>(
+				this,
+				subquery.getJavaType(),
+				subquery,
+				SubqueryComparisonModifierExpression.Modifier.ANY
+		);
 	}
 
-	public Expression<String> substring(Expression<String> stringExpression, Expression<Integer> integerExpression, Expression<Integer> integerExpression1) {
-		return null;
-	}
 
-	public Expression<String> substring(Expression<String> stringExpression, int i, int i1) {
-		return null;
-	}
+	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	public Expression<String> trim(Expression<String> stringExpression) {
+	public <C extends Collection<?>> Predicate isEmpty(Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> trim(Trimspec trimspec, Expression<String> stringExpression) {
+	public <C extends Collection<?>> Predicate isNotEmpty(Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> trim(Expression<Character> characterExpression, Expression<String> stringExpression) {
+	public <C extends Collection<?>> Expression<Integer> size(C c) {
 		return null;
 	}
 
-	public Expression<String> trim(Trimspec trimspec, Expression<Character> characterExpression, Expression<String> stringExpression) {
+	public <C extends Collection<?>> Expression<Integer> size(Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> trim(char c, Expression<String> stringExpression) {
+	public <E, C extends Collection<E>> Predicate isMember(E e, Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> trim(Trimspec trimspec, char c, Expression<String> stringExpression) {
+	public <E, C extends Collection<E>> Predicate isNotMember(E e, Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> lower(Expression<String> stringExpression) {
+	public <E, C extends Collection<E>> Predicate isMember(Expression<E> eExpression, Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<String> upper(Expression<String> stringExpression) {
+	public <E, C extends Collection<E>> Predicate isNotMember(Expression<E> eExpression, Expression<C> cExpression) {
 		return null;
 	}
 
-	public Expression<Integer> length(Expression<String> stringExpression) {
+	public <V, M extends Map<?, V>> Expression<Collection<V>> values(M map) {
 		return null;
 	}
 
-	public Expression<Integer> locate(Expression<String> stringExpression, Expression<String> stringExpression1) {
+	public <K, M extends Map<K, ?>> Expression<Set<K>> keys(M m) {
 		return null;
 	}
 
-	public Expression<Integer> locate(Expression<String> stringExpression, Expression<String> stringExpression1, Expression<Integer> integerExpression) {
+	public Expression<String> concat(Expression<String> stringExpression, Expression<String> stringExpression1) {
 		return null;
 	}
 
-	public Expression<Integer> locate(Expression<String> stringExpression, String s) {
+	public Expression<String> concat(Expression<String> stringExpression, String s) {
 		return null;
 	}
 
-	public Expression<Integer> locate(Expression<String> stringExpression, String s, int i) {
+	public Expression<String> concat(String s, Expression<String> stringExpression) {
 		return null;
 	}
 
-	public Expression<java.sql.Date> currentDate() {
-		return null;
-	}
-
-	public Expression<java.sql.Timestamp> currentTimestamp() {
-		return null;
-	}
-
-	public Expression<java.sql.Time> currentTime() {
-		return null;
-	}
-
 	public <Y> Expression<Y> coalesce(Expression<? extends Y> expression, Expression<? extends Y> expression1) {
 		return null;
 	}
@@ -931,8 +1147,4 @@
 	public <R> Case<R> selectCase() {
 		return null;
 	}
-
-	public <T> Expression<T> function(String s, Class<T> tClass, Expression<?>... expressions) {
-		return null;
-	}
 }

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryArithmeticOperation.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryArithmeticOperation.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryArithmeticOperation.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression;
+
+import javax.persistence.criteria.Expression;
+
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models standard arithmetc operations with two operands.
+ *
+ * @author Steve Ebersole
+ */
+public class BinaryArithmeticOperation<N extends Number>
+		extends ExpressionImpl<N>
+		implements BinaryOperatorExpression<N> {
+
+	public static enum Operation {
+		ADD, SUBTRACT, MULTIPLY, DIVIDE, QUOT, MOD
+	}
+
+	private final Operation operator;
+	private final Expression<? extends N> rhs;
+	private final Expression<? extends N> lhs;
+
+	public BinaryArithmeticOperation(
+			QueryBuilderImpl queryBuilder,
+			Class<N> javaType,
+			Operation operator,
+			Expression<? extends N> rhs,
+			Expression<? extends N> lhs) {
+		super( queryBuilder, javaType );
+		this.operator = operator;
+		this.rhs = rhs;
+		this.lhs = lhs;
+	}
+
+	public BinaryArithmeticOperation(
+			QueryBuilderImpl queryBuilder,
+			Class<N> javaType,
+			Operation operator,
+			Expression<? extends N> rhs,
+			N lhs) {
+		super( queryBuilder, javaType );
+		this.operator = operator;
+		this.rhs = rhs;
+		this.lhs = new LiteralExpression<N>( queryBuilder, lhs );
+	}
+
+	public BinaryArithmeticOperation(
+			QueryBuilderImpl queryBuilder,
+			Class<N> javaType,
+			Operation operator,
+			N rhs,
+			Expression<? extends N> lhs) {
+		super( queryBuilder, javaType );
+		this.operator = operator;
+		this.rhs = new LiteralExpression<N>( queryBuilder, rhs );
+		this.lhs = lhs;
+	}
+
+	public Operation getOperator() {
+		return operator;
+	}
+
+	public Expression<? extends N> getRightHandOperand() {
+		return rhs;
+	}
+
+	public Expression<? extends N> getLeftHandOperand() {
+		return lhs;
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryOperatorExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryOperatorExpression.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/BinaryOperatorExpression.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression;
+
+import javax.persistence.criteria.Expression;
+
+/**
+ * Contract for operators with two operands.
+ *
+ * @author Steve Ebersole
+ */
+public interface BinaryOperatorExpression<T> extends Expression<T> {
+	/**
+	 * Get the right-hand operand.
+	 *
+	 * @return The right-hand operand.
+	 */
+	public Expression<?> getRightHandOperand();
+
+	/**
+	 * Get the left-hand operand.
+	 *
+	 * @return The left-hand operand.
+	 */
+	public Expression<?> getLeftHandOperand();
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SubqueryComparisonModifierExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SubqueryComparisonModifierExpression.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/SubqueryComparisonModifierExpression.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,36 @@
+package org.hibernate.ejb.criteria.expression;
+
+import javax.persistence.criteria.Subquery;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Represents a {@link Modifier#ALL}, {@link Modifier#ANY}, {@link Modifier#SOME} modifier appplied to a subquery as
+ * part of a comparison.
+ *
+ * @author Steve Ebersole
+ */
+public class SubqueryComparisonModifierExpression<Y> extends ExpressionImpl<Y> {
+	public static enum Modifier { ALL, SOME, ANY };
+
+	private final Subquery<Y> subquery;
+	private final Modifier modifier;
+
+	public SubqueryComparisonModifierExpression(
+			QueryBuilderImpl queryBuilder,
+			Class<Y> javaType,
+			Subquery<Y> subquery,
+			Modifier modifier) {
+		super(queryBuilder, javaType);
+		this.subquery = subquery;
+		this.modifier = modifier;
+	}
+
+	public Modifier getModifier() {
+		return modifier;
+	}
+
+	public Subquery<Y> getSubquery() {
+		return subquery;
+	}
+
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryArithmeticOperation.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryArithmeticOperation.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryArithmeticOperation.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,39 @@
+package org.hibernate.ejb.criteria.expression;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models arithmetc operations with two operands.
+ *
+ * @author Steve Ebersole
+ */
+public class UnaryArithmeticOperation<T> 
+		extends ExpressionImpl<T>
+		implements UnaryOperatorExpression<T> {
+
+	public static enum Operation {
+		UNARY_PLUS, UNARY_MINUS
+	}
+
+	private final Operation operation;
+	private final Expression<T> operand;
+
+	public UnaryArithmeticOperation(
+			QueryBuilderImpl queryBuilder,
+			Operation operation,
+			Expression<T> operand) {
+		super( queryBuilder, operand.getJavaType() );
+		this.operation = operation;
+		this.operand = operand;
+	}
+
+	public Expression<T> getOperand() {
+		return operand;
+	}
+
+	public Operation getOperation() {
+		return operation;
+	}
+
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryOperatorExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryOperatorExpression.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/UnaryOperatorExpression.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression;
+
+import javax.persistence.criteria.Expression;
+
+/**
+ * Contract for operators with a single operand.
+ *
+ * @author Steve Ebersole
+ */
+public interface UnaryOperatorExpression<T> extends Expression<T> {
+	/**
+	 * Get the operand.
+	 *
+	 * @return The operand.
+	 */
+	public Expression<?> getOperand();
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AbsFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AbsFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AbsFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>ABS</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class AbsFunction<N extends Number>
+		extends BasicFunctionExpression<N> {
+
+	public static final String NAME = "abs";
+
+	public AbsFunction(QueryBuilderImpl queryBuilder, Expression<N> expression) {
+		super( queryBuilder, expression.getJavaType(), NAME, expression );
+	}
+}

Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AggregationFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AggregationFunction.java	2009-08-06 18:39:33 UTC (rev 17250)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/AggregationFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -1,7 +1,26 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
 package org.hibernate.ejb.criteria.expression.function;
 
-import java.util.Collections;
-import java.util.List;
 import javax.persistence.criteria.Expression;
 import org.hibernate.ejb.criteria.QueryBuilderImpl;
 import org.hibernate.ejb.criteria.expression.LiteralExpression;
@@ -12,8 +31,6 @@
  * @author Steve Ebersole
  */
 public class AggregationFunction<T> extends BasicFunctionExpression<T> {
-	private static final List<Expression<?>> NO_ARGS = Collections.emptyList();
-
 	/**
 	 * Constructs an aggregation function with no arguments (<tt>COUNT(*)</tt> e.g.).
 	 * 

Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/BasicFunctionExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/BasicFunctionExpression.java	2009-08-06 18:39:33 UTC (rev 17250)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/BasicFunctionExpression.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -25,22 +25,35 @@
 import org.hibernate.ejb.criteria.expression.*;
 import java.util.List;
 import java.util.Arrays;
+import java.util.Collections;
 import javax.persistence.criteria.Expression;
 
 import org.hibernate.ejb.criteria.QueryBuilderImpl;
 
 /**
- * TODO : javadoc
+ * Models the basic conept of a SQL function.
  *
  * @author Steve Ebersole
  */
-public class BasicFunctionExpression<X> extends ExpressionImpl<X> implements FunctionExpression<X> {
+public class BasicFunctionExpression<X>
+		extends ExpressionImpl<X>
+		implements FunctionExpression<X> {
+
+	public static final List<Expression<?>> NO_ARGS = Collections.emptyList();
+
 	private final String functionName;
 	private final List<Expression<?>> argumentExpressions;
 
 	public BasicFunctionExpression(
 			QueryBuilderImpl queryBuilder,
 			Class<X> javaType,
+			String functionName) {
+		this( queryBuilder, javaType, functionName, NO_ARGS );
+	}
+
+	public BasicFunctionExpression(
+			QueryBuilderImpl queryBuilder,
+			Class<X> javaType,
 			String functionName,
 			List<Expression<?>> argumentExpressions) {
 		super( queryBuilder, javaType );

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentDateFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentDateFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentDateFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>CURRENT_DATE</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class CurrentDateFunction extends BasicFunctionExpression<java.sql.Date> {
+	public static final String NAME = "current_date";
+
+	public CurrentDateFunction(QueryBuilderImpl queryBuilder) {
+		super( queryBuilder, java.sql.Date.class, NAME );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimeFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimeFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimeFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>CURRENT_TIME</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class CurrentTimeFunction extends BasicFunctionExpression<java.sql.Time> {
+	public static final String NAME = "current_time";
+
+	public CurrentTimeFunction(QueryBuilderImpl queryBuilder) {
+		super( queryBuilder, java.sql.Time.class, NAME );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimestampFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimestampFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/CurrentTimestampFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import java.sql.Timestamp;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>CURRENT_TIMESTAMP</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class CurrentTimestampFunction extends BasicFunctionExpression<Timestamp> {
+	public static final String NAME = "current_timestamp";
+
+	public CurrentTimestampFunction(QueryBuilderImpl queryBuilder) {
+		super( queryBuilder, Timestamp.class, NAME );
+	}
+}

Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/FunctionExpression.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/FunctionExpression.java	2009-08-06 18:39:33 UTC (rev 17250)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/FunctionExpression.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -24,7 +24,7 @@
 import javax.persistence.criteria.Expression;
 
 /**
- * Models an expression resolved as a SQL function call.
+ * Contract for expressions which model a SQL function call.
  *
  * @param <T> The type of the function result.
  *

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LengthFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LengthFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LengthFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>LENGTH</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class LengthFunction extends BasicFunctionExpression<Integer> {
+	public static final String NAME = "length";
+
+	public LengthFunction(QueryBuilderImpl queryBuilder, Expression<String> value) {
+		super( queryBuilder, Integer.class, NAME, value );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LocateFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LocateFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LocateFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+import org.hibernate.ejb.criteria.expression.LiteralExpression;
+
+/**
+ * Models the ANSI SQL <tt>LOCATE</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class LocateFunction extends BasicFunctionExpression<Integer> {
+	public static final String NAME = "locate";
+
+	private final Expression<String> pattern;
+	private final Expression<String> string;
+	private final Expression<Integer> start;
+
+	public LocateFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> pattern,
+			Expression<String> string,
+			Expression<Integer> start) {
+		super( queryBuilder, Integer.class, NAME );
+		this.pattern = pattern;
+		this.string = string;
+		this.start = start;
+	}
+
+	public LocateFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> pattern,
+			Expression<String> string) {
+		this( queryBuilder, pattern, string, null );
+	}
+
+	public LocateFunction(QueryBuilderImpl queryBuilder, String pattern, Expression<String> string) {
+		this(
+				queryBuilder,
+				new LiteralExpression<String>( queryBuilder, pattern ),
+				string,
+				null
+		);
+	}
+
+	public LocateFunction(QueryBuilderImpl queryBuilder, String pattern, Expression<String> string, int start) {
+		this(
+				queryBuilder,
+				new LiteralExpression<String>( queryBuilder, pattern ),
+				string,
+				new LiteralExpression<Integer>( queryBuilder, start )
+		);
+	}
+
+	public Expression<String> getPattern() {
+		return pattern;
+	}
+
+	public Expression<Integer> getStart() {
+		return start;
+	}
+
+	public Expression<String> getString() {
+		return string;
+	}
+
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LowerFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LowerFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/LowerFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>LOWER</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class LowerFunction extends BasicFunctionExpression<String> {
+	public static final String NAME = "lower";
+
+	public LowerFunction(QueryBuilderImpl queryBuilder, Expression<String> string) {
+		super( queryBuilder, String.class, NAME, string );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SqrtFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SqrtFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SqrtFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>SQRT</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class SqrtFunction extends BasicFunctionExpression<Double> {
+	public static final String NAME = "sqrt";
+
+	public SqrtFunction(QueryBuilderImpl queryBuilder, Expression<? extends Number> expression) {
+		super( queryBuilder, Double.class, NAME, expression );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SubstringFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SubstringFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/SubstringFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,74 @@
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+import org.hibernate.ejb.criteria.expression.LiteralExpression;
+
+/**
+ * Models the ANSI SQL <tt>SUBSTRING</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class SubstringFunction extends BasicFunctionExpression<String> {
+	public static final String NAME = "substring";
+
+	private final Expression<String> value;
+	private final Expression<Integer> start;
+	private final Expression<Integer> length;
+
+	public SubstringFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> value,
+			Expression<Integer> start,
+			Expression<Integer> length) {
+		super( queryBuilder, String.class, NAME );
+		this.value = value;
+		this.start = start;
+		this.length = length;
+	}
+
+	public SubstringFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> value, 
+			Expression<Integer> start) {
+		this( queryBuilder, value, start, (Expression<Integer>)null );
+	}
+
+	public SubstringFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> value,
+			int start) {
+		this( 
+				queryBuilder,
+				value,
+				new LiteralExpression<Integer>( queryBuilder, start )
+		);
+	}
+
+	public SubstringFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> value,
+			int start,
+			int length) {
+		this(
+				queryBuilder,
+				value,
+				new LiteralExpression<Integer>( queryBuilder, start ),
+				new LiteralExpression<Integer>( queryBuilder, length )
+		);
+	}
+
+	public Expression<Integer> getLength() {
+		return length;
+	}
+
+	public Expression<Integer> getStart() {
+		return start;
+	}
+
+	public Expression<String> getValue() {
+		return value;
+	}
+
+
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/TrimFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/TrimFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/TrimFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,83 @@
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import javax.persistence.criteria.QueryBuilder.Trimspec;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+import org.hibernate.ejb.criteria.expression.LiteralExpression;
+
+/**
+ * Models the ANSI SQL <tt>TRIM</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class TrimFunction extends BasicFunctionExpression<String> {
+	public static final String NAME = "trim";
+	public static final Trimspec DEFAULT_TRIMSPEC = Trimspec.BOTH;
+	public static final char DEFAULT_TRIM_CHAR = ' ';
+
+	private final Trimspec trimspec;
+	private final Expression<Character> trimCharacter;
+	private final Expression<String> trimSource;
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			Trimspec trimspec,
+			Expression<Character> trimCharacter,
+			Expression<String> trimSource) {
+		super( queryBuilder, String.class, NAME );
+		this.trimspec = trimspec;
+		this.trimCharacter = trimCharacter;
+		this.trimSource = trimSource;
+	}
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			Trimspec trimspec,
+			char trimCharacter,
+			Expression<String> trimSource) {
+		super( queryBuilder, String.class, NAME );
+		this.trimspec = trimspec;
+		this.trimCharacter = new LiteralExpression<Character>( queryBuilder, trimCharacter );
+		this.trimSource = trimSource;
+	}
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> trimSource) {
+		this( queryBuilder, DEFAULT_TRIMSPEC, DEFAULT_TRIM_CHAR, trimSource );
+	}
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			Expression<Character> trimCharacter,
+			Expression<String> trimSource) {
+		this( queryBuilder, DEFAULT_TRIMSPEC, trimCharacter, trimSource );
+	}
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			char trimCharacter,
+			Expression<String> trimSource) {
+		this( queryBuilder, DEFAULT_TRIMSPEC, trimCharacter, trimSource );
+	}
+
+	public TrimFunction(
+			QueryBuilderImpl queryBuilder,
+			Trimspec trimspec,
+			Expression<String> trimSource) {
+		this( queryBuilder, trimspec, DEFAULT_TRIM_CHAR, trimSource );
+	}
+
+	public Expression<Character> getTrimCharacter() {
+		return trimCharacter;
+	}
+
+	public Expression<String> getTrimSource() {
+		return trimSource;
+	}
+
+	public Trimspec getTrimspec() {
+		return trimspec;
+	}
+
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/UpperFunction.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/UpperFunction.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/expression/function/UpperFunction.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.expression.function;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+
+/**
+ * Models the ANSI SQL <tt>UPPER</tt> function.
+ *
+ * @author Steve Ebersole
+ */
+public class UpperFunction extends BasicFunctionExpression<String> {
+	public static final String NAME = "upper";
+
+	public UpperFunction(QueryBuilderImpl queryBuilder, Expression<String> string) {
+		super( queryBuilder, String.class, NAME, string );
+	}
+}

Added: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/LikePredicate.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/LikePredicate.java	                        (rev 0)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/criteria/predicate/LikePredicate.java	2009-08-07 12:12:20 UTC (rev 17251)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ */
+package org.hibernate.ejb.criteria.predicate;
+
+import javax.persistence.criteria.Expression;
+import org.hibernate.ejb.criteria.QueryBuilderImpl;
+import org.hibernate.ejb.criteria.expression.LiteralExpression;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class LikePredicate extends AbstractSimplePredicate {
+	private final Expression<String> matchExpression;
+	private final Expression<String> pattern;
+	private final Expression<Character> escapeCharacter;
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			Expression<String> pattern) {
+		this( queryBuilder, matchExpression, pattern, null );
+	}
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			String pattern) {
+		this( queryBuilder, matchExpression, new LiteralExpression<String>( queryBuilder, pattern) );
+	}
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			Expression<String> pattern,
+			Expression<Character> escapeCharacter) {
+		super( queryBuilder );
+		this.matchExpression = matchExpression;
+		this.pattern = pattern;
+		this.escapeCharacter = escapeCharacter;
+	}
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			Expression<String> pattern,
+			char escapeCharacter) {
+		this(
+				queryBuilder,
+				matchExpression,
+				pattern,
+				new LiteralExpression<Character>( queryBuilder, escapeCharacter )
+		);
+	}
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			String pattern,
+			char escapeCharacter) {
+		this(
+				queryBuilder,
+				matchExpression,
+				new LiteralExpression<String>( queryBuilder, pattern ),
+				new LiteralExpression<Character>( queryBuilder, escapeCharacter )
+		);
+	}
+
+	public LikePredicate(
+			QueryBuilderImpl queryBuilder,
+			Expression<String> matchExpression,
+			String pattern,
+			Expression<Character> escapeCharacter) {
+		this(
+				queryBuilder,
+				matchExpression,
+				new LiteralExpression<String>( queryBuilder, pattern ),
+				escapeCharacter
+		);
+	}
+
+	public Expression<Character> getEscapeCharacter() {
+		return escapeCharacter;
+	}
+
+	public Expression<String> getMatchExpression() {
+		return matchExpression;
+	}
+
+	public Expression<String> getPattern() {
+		return pattern;
+	}
+
+
+}



More information about the hibernate-commits mailing list