KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > criterion > Expression


1 //$Id: Expression.java,v 1.9 2005/02/12 07:19:13 steveebersole Exp $
2
package org.hibernate.criterion;
3
4 import org.hibernate.type.Type;
5 import org.hibernate.util.ArrayHelper;
6
7
8 /**
9  * This class is semi-deprecated. Use <tt>Restrictions</tt>.
10  *
11  * @see Restrictions
12  * @author Gavin King
13  */

14 public final class Expression extends Restrictions {
15
16     private Expression() {
17         //cannot be instantiated
18
}
19
20     /**
21      * Apply a constraint expressed in SQL, with the given JDBC
22      * parameters. Any occurrences of <tt>{alias}</tt> will be
23      * replaced by the table alias.
24      *
25      * @param sql
26      * @param values
27      * @param types
28      * @return Criterion
29      */

30     public static Criterion sql(String JavaDoc sql, Object JavaDoc[] values, Type[] types) {
31         return new SQLCriterion(sql, values, types);
32     }
33     /**
34      * Apply a constraint expressed in SQL, with the given JDBC
35      * parameter. Any occurrences of <tt>{alias}</tt> will be replaced
36      * by the table alias.
37      *
38      * @param sql
39      * @param value
40      * @param type
41      * @return Criterion
42      */

43     public static Criterion sql(String JavaDoc sql, Object JavaDoc value, Type type) {
44         return new SQLCriterion(sql, new Object JavaDoc[] { value }, new Type[] { type } );
45     }
46     /**
47      * Apply a constraint expressed in SQL. Any occurrences of <tt>{alias}</tt>
48      * will be replaced by the table alias.
49      *
50      * @param sql
51      * @return Criterion
52      */

53     public static Criterion sql(String JavaDoc sql) {
54         return new SQLCriterion(sql, ArrayHelper.EMPTY_OBJECT_ARRAY, ArrayHelper.EMPTY_TYPE_ARRAY);
55     }
56
57 }
58
Popular Tags