org.apache.torque.util
Class Criteria

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by org.apache.torque.util.Criteria
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class Criteria
extends java.util.Hashtable

This is a utility class that is used for retrieving different types of values from a hashtable based on a simple name string. This class is meant to minimize the amount of casting that needs to be done when working with Hashtables. NOTE: other methods will be added as needed and as time permits.

Version:
$Id: Criteria.java 591648 2007-11-03 16:34:00Z tfischer $
Author:
Frank Y. Kim, John D. McNally, Brett McLaughlin, Eric Dobbs, Henning P. Schmiedehausen, Sam Joseph, Martin Poeschl, Thomas Fischer, Scott Eade, Thomas Vandahl
See Also:
Serialized Form

Nested Class Summary
 class Criteria.Criterion
          This is an inner class that describes an object in the criteria.
static class Criteria.Join
          Data object to describe a join between two tables, for example
 
Field Summary
static SqlEnum ALL
          Comparison type.
static SqlEnum ALT_NOT_EQUAL
          Comparison type.
static SqlEnum CURRENT_DATE
          "CURRENT_DATE" ANSI SQL function
static SqlEnum CURRENT_TIME
          "CURRENT_TIME" ANSI SQL function
static SqlEnum CUSTOM
          Comparison type.
static SqlEnum DISTINCT
          Comparison type.
static SqlEnum EQUAL
          Comparison type.
static SqlEnum GREATER_EQUAL
          Comparison type.
static SqlEnum GREATER_THAN
          Comparison type.
static SqlEnum ILIKE
          Comparison type.
static SqlEnum IN
          Comparison type.
static SqlEnum INNER_JOIN
          "INNER JOIN" SQL statement
static SqlEnum ISNOTNULL
          "IS NOT NULL" null comparison
static SqlEnum ISNULL
          "IS NULL" null comparison
static SqlEnum JOIN
          Comparison type.
static SqlEnum LEFT_JOIN
          "LEFT JOIN" SQL statement
static SqlEnum LESS_EQUAL
          Comparison type.
static SqlEnum LESS_THAN
          Comparison type.
static SqlEnum LIKE
          Comparison type.
static SqlEnum NOT_EQUAL
          Comparison type.
static SqlEnum NOT_ILIKE
          Comparison type.
static SqlEnum NOT_IN
          Comparison type.
static SqlEnum NOT_LIKE
          Comparison type.
static SqlEnum RIGHT_JOIN
          "RIGHT JOIN" SQL statement
 
Constructor Summary
Criteria()
          Creates a new instance with the default capacity.
Criteria(int initialCapacity)
          Creates a new instance with the specified capacity.
Criteria(java.lang.String dbName)
          Creates a new instance with the default capacity which corresponds to the specified database.
Criteria(java.lang.String dbName, int initialCapacity)
          Creates a new instance with the specified capacity which corresponds to the specified database.
 
Method Summary
 Criteria add(Criteria.Criterion c)
          This method adds a prepared Criterion object to the Criteria.
 Criteria add(java.lang.String column, boolean value)
          Convenience method to add a boolean to Criteria.
 Criteria add(java.lang.String column, boolean value, SqlEnum comparison)
          Convenience method to add a boolean to Criteria.
 Criteria add(java.lang.String column, double value)
          Convenience method to add a double to Criteria.
 Criteria add(java.lang.String column, double value, SqlEnum comparison)
          Convenience method to add a double to Criteria.
 Criteria add(java.lang.String column, float value)
          Convenience method to add a float to Criteria.
 Criteria add(java.lang.String column, float value, SqlEnum comparison)
          Convenience method to add a float to Criteria.
 Criteria add(java.lang.String column, int value)
          Convenience method to add an int to Criteria.
 Criteria add(java.lang.String column, int value, SqlEnum comparison)
          Convenience method to add an int to Criteria.
 Criteria add(java.lang.String column, long value)
          Convenience method to add a long to Criteria.
 Criteria add(java.lang.String column, long value, SqlEnum comparison)
          Convenience method to add a long to Criteria.
 Criteria add(java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria add(java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 Criteria add(java.lang.String table, java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria add(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 void addAlias(java.lang.String alias, java.lang.String table)
          Allows one to specify an alias for a table that can be used in various parts of the SQL.
 Criteria addAscendingOrderByColumn(java.lang.String name)
          Add order by column name, explicitly specifying ascending.
 Criteria addAsColumn(java.lang.String name, java.lang.String clause)
          Add an AS clause to the select columns.
 Criteria addDate(java.lang.String column, int year, int month, int date)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria addDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria addDescendingOrderByColumn(java.lang.String name)
          Add order by column name, explicitly specifying descending.
 Criteria addGroupByColumn(java.lang.String groupBy)
          Add group by column name.
 Criteria addHaving(Criteria.Criterion having)
          This method adds a prepared Criterion object to the Criteria as a having clause.
 Criteria addIn(java.lang.String column, int[] values)
          Adds an 'IN' clause with the criteria supplied as an int array.
 Criteria addIn(java.lang.String column, java.util.List values)
          Adds an 'IN' clause with the criteria supplied as a List.
 Criteria addIn(java.lang.String column, java.lang.Object[] values)
          Adds an 'IN' clause with the criteria supplied as an Object array.
 Criteria addJoin(java.lang.String left, java.lang.String right)
          This is the way that you should add a join of two tables.
 Criteria addJoin(java.lang.String left, java.lang.String right, SqlEnum operator)
          This is the way that you should add a join of two tables.
 Criteria addNotIn(java.lang.String column, int[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an int array.
 Criteria addNotIn(java.lang.String column, java.util.List values)
          Adds a 'NOT IN' clause with the criteria supplied as a List.
 Criteria addNotIn(java.lang.String column, java.lang.Object[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an Object array.
 Criteria addSelectColumn(java.lang.String name)
          Add select column.
 Criteria and(Criteria.Criterion c)
          This method adds a prepared Criterion object to the Criteria.
 Criteria and(java.lang.String column, boolean value)
          Convenience method to add a boolean to Criteria.
 Criteria and(java.lang.String column, boolean value, SqlEnum comparison)
          Convenience method to add a boolean to Criteria.
 Criteria and(java.lang.String column, double value)
          Convenience method to add a double to Criteria.
 Criteria and(java.lang.String column, double value, SqlEnum comparison)
          Convenience method to add a double to Criteria.
 Criteria and(java.lang.String column, float value)
          Convenience method to add a float to Criteria.
 Criteria and(java.lang.String column, float value, SqlEnum comparison)
          Convenience method to add a float to Criteria.
 Criteria and(java.lang.String column, int value)
          Convenience method to add an int to Criteria.
 Criteria and(java.lang.String column, int value, SqlEnum comparison)
          Convenience method to add an int to Criteria.
 Criteria and(java.lang.String column, long value)
          Convenience method to add a long to Criteria.
 Criteria and(java.lang.String column, long value, SqlEnum comparison)
          Convenience method to add a long to Criteria.
 Criteria and(java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria and(java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 Criteria and(java.lang.String table, java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria and(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 Criteria andDate(java.lang.String column, int year, int month, int date)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria andDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria andIn(java.lang.String column, int[] values)
          Adds an 'IN' clause with the criteria supplied as an int array.
 Criteria andIn(java.lang.String column, java.util.List values)
          Adds an 'IN' clause with the criteria supplied as a List.
 Criteria andIn(java.lang.String column, java.lang.Object[] values)
          Adds an 'IN' clause with the criteria supplied as an Object array.
 Criteria andNotIn(java.lang.String column, int[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an int array.
 Criteria andNotIn(java.lang.String column, java.util.List values)
          Adds a 'NOT IN' clause with the criteria supplied as a List.
 Criteria andNotIn(java.lang.String column, java.lang.Object[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an Object array.
 void clear()
          Brings this criteria back to its initial state, so that it can be reused as if it was new.
 boolean containsKey(java.lang.String table, java.lang.String column)
          Does this Criteria Object contain the specified key?
 boolean equals(java.lang.Object crit)
          This method checks another Criteria to see if they contain the same attributes and hashtable entries.
 java.lang.Object get(java.lang.Object key)
          Overrides Hashtable get, so that the value placed in the Criterion is returned instead of the Criterion.
 java.util.Map getAliases()
          Get the table aliases.
 java.util.Map getAsColumns()
          Get the column aliases.
 java.math.BigDecimal getBigDecimal(java.lang.String name)
          Convenience method to return a BigDecimal.
 java.math.BigDecimal getBigDecimal(java.lang.String table, java.lang.String column)
          Convenience method to return a BigDecimal.
 boolean getBoolean(java.lang.String column)
          Convenience method to return value as a boolean.
 boolean getBoolean(java.lang.String table, java.lang.String column)
          Convenience method to return value as a boolean.
 java.lang.String getColumnName(java.lang.String name)
          Method to return a String table name.
 SqlEnum getComparison(java.lang.String key)
          Method to return a comparison String.
 SqlEnum getComparison(java.lang.String table, java.lang.String column)
          Method to return a comparison String.
 Criteria.Criterion getCriterion(java.lang.String column)
          Method to return criteria related to columns in a table.
 Criteria.Criterion getCriterion(java.lang.String table, java.lang.String column)
          Method to return criteria related to a column in a table.
 java.util.Date getDate(java.lang.String name)
          Convenience method to return a Date.
 java.util.Date getDate(java.lang.String table, java.lang.String column)
          Convenience method to return a Date.
 java.lang.String getDbName()
          Get the Database(Map) name.
 double getDouble(java.lang.String name)
          Convenience method to return a double.
 double getDouble(java.lang.String table, java.lang.String column)
          Convenience method to return a double.
 float getFloat(java.lang.String name)
          Convenience method to return a float.
 float getFloat(java.lang.String table, java.lang.String column)
          Convenience method to return a float.
 UniqueList getGroupByColumns()
          Get group by columns.
 Criteria.Criterion getHaving()
          Get Having Criterion.
 int getInt(java.lang.String name)
          Convenience method to return an int.
 int getInt(java.lang.String table, java.lang.String column)
          Convenience method to return an int.
 java.lang.Integer getInteger(java.lang.String name)
          Convenience method to return an Integer.
 java.lang.Integer getInteger(java.lang.String table, java.lang.String column)
          Convenience method to return an Integer.
 java.util.List getJoinL()
          Deprecated. This method is no longer used by BasePeer.
 java.util.List getJoinR()
          Deprecated. This method is no longer used by BasePeer.
 java.util.List getJoins()
          get the List of Joins.
 int getLimit()
          Get limit.
 java.util.List getList(java.lang.String name)
          Convenience method to return a List.
 java.util.List getList(java.lang.String table, java.lang.String column)
          Convenience method to return a List.
 long getLong(java.lang.String name)
          Convenience method to return a long.
 long getLong(java.lang.String table, java.lang.String column)
          Convenience method to return a long.
 Criteria.Criterion getNewCriterion(java.lang.String column, java.lang.Object value, SqlEnum comparison)
          Method to return criterion that is not added automatically to this Criteria.
 Criteria.Criterion getNewCriterion(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
          Method to return criterion that is not added automatically to this Criteria.
 ObjectKey getObjectKey(java.lang.String name)
          Convenience method to return an ObjectKey.
 ObjectKey getObjectKey(java.lang.String table, java.lang.String column)
          Convenience method to return an ObjectKey.
 int getOffset()
          Get offset.
 UniqueList getOrderByColumns()
          Get order by columns.
 UniqueList getSelectColumns()
          Get select columns.
 UniqueList getSelectModifiers()
          Get select modifiers.
 java.lang.String getString(java.lang.String name)
          Convenience method to return a String.
 java.lang.String getString(java.lang.String table, java.lang.String column)
          Convenience method to return a String.
 java.lang.String getTableForAlias(java.lang.String alias)
          Returns the table name associated with an alias.
 java.lang.String getTableName(java.lang.String name)
          Method to return a String table name.
 java.lang.Object getValue(java.lang.String name)
          Method to return the value that was added to Criteria.
 java.lang.Object getValue(java.lang.String table, java.lang.String column)
          Method to return the value that was added to Criteria.
 int hashCode()
          Returns the hash code value for this Join.
 boolean isCascade()
          Is cascade set?
 boolean isIgnoreCase()
          Is ignore case on or off?
 boolean isSingleRecord()
          Is single record?
protected  boolean isUseTransaction()
          called by BasePeer to determine whether the sql command specified by this criteria must be wrapped in a transaction.
 Criteria or(Criteria.Criterion c)
          This method adds a prepared Criterion object to the Criteria.
 Criteria or(java.lang.String column, boolean value)
          Convenience method to add a boolean to Criteria.
 Criteria or(java.lang.String column, boolean value, SqlEnum comparison)
          Convenience method to add a boolean to Criteria.
 Criteria or(java.lang.String column, double value)
          Convenience method to add a double to Criteria.
 Criteria or(java.lang.String column, double value, SqlEnum comparison)
          Convenience method to add a double to Criteria.
 Criteria or(java.lang.String column, float value)
          Convenience method to add a float to Criteria.
 Criteria or(java.lang.String column, float value, SqlEnum comparison)
          Convenience method to add a float to Criteria.
 Criteria or(java.lang.String column, int value)
          Convenience method to add an int to Criteria.
 Criteria or(java.lang.String column, int value, SqlEnum comparison)
          Convenience method to add an int to Criteria.
 Criteria or(java.lang.String column, long value)
          Convenience method to add a long to Criteria.
 Criteria or(java.lang.String column, long value, SqlEnum comparison)
          Convenience method to add a long to Criteria.
 Criteria or(java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria or(java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 Criteria or(java.lang.String table, java.lang.String column, java.lang.Object value)
          This method adds a new criterion to the list of criterias.
 Criteria or(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
          This method adds a new criterion to the list of criterias.
 Criteria orDate(java.lang.String column, int year, int month, int date)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria orDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
          Convenience method to add a Date object specified by year, month, and date into the Criteria.
 Criteria orIn(java.lang.String column, int[] values)
          Adds an 'IN' clause with the criteria supplied as an int array.
 Criteria orIn(java.lang.String column, java.util.List values)
          Adds an 'IN' clause with the criteria supplied as a List.
 Criteria orIn(java.lang.String column, java.lang.Object[] values)
          Adds an 'IN' clause with the criteria supplied as an Object array.
 Criteria orNotIn(java.lang.String column, int[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an int array.
 Criteria orNotIn(java.lang.String column, java.util.List values)
          Adds a 'NOT IN' clause with the criteria supplied as a List.
 Criteria orNotIn(java.lang.String column, java.lang.Object[] values)
          Adds a 'NOT IN' clause with the criteria supplied as an Object array.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Overrides Hashtable put, so that this object is returned instead of the value previously in the Criteria object.
 void putAll(java.util.Map t)
          Copies all of the mappings from the specified Map to this Criteria These mappings will replace any mappings that this Criteria had for any of the keys currently in the specified Map.
 java.lang.Object remove(java.lang.String key)
          Remove an object from the criteria.
 void setAll()
          Adds "ALL " to the SQL statement.
 Criteria setCascade(boolean b)
          Set cascade.
 void setDbName(java.lang.String dbName)
          Set the DatabaseMap name.
 void setDistinct()
          Adds "DISTINCT " to the SQL statement.
 Criteria setIgnoreCase(boolean b)
          Sets ignore case.
 Criteria setLimit(int limit)
          Set limit.
 Criteria setOffset(int offset)
          Set offset.
 Criteria setSingleRecord(boolean b)
          Set single record? Set this to true if you expect the query to result in only a single result record (the default behaviour is to throw a TorqueException if multiple records are returned when the query is executed).
 void setUseTransaction(boolean v)
          Will force the sql represented by this criteria to be executed within a transaction.
 java.lang.String toString()
          Build a string representation of the Criteria.
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, entrySet, isEmpty, keys, keySet, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUAL

public static final SqlEnum EQUAL
Comparison type.


NOT_EQUAL

public static final SqlEnum NOT_EQUAL
Comparison type.


ALT_NOT_EQUAL

public static final SqlEnum ALT_NOT_EQUAL
Comparison type.


GREATER_THAN

public static final SqlEnum GREATER_THAN
Comparison type.


LESS_THAN

public static final SqlEnum LESS_THAN
Comparison type.


GREATER_EQUAL

public static final SqlEnum GREATER_EQUAL
Comparison type.


LESS_EQUAL

public static final SqlEnum LESS_EQUAL
Comparison type.


LIKE

public static final SqlEnum LIKE
Comparison type.


NOT_LIKE

public static final SqlEnum NOT_LIKE
Comparison type.


ILIKE

public static final SqlEnum ILIKE
Comparison type.


NOT_ILIKE

public static final SqlEnum NOT_ILIKE
Comparison type.


CUSTOM

public static final SqlEnum CUSTOM
Comparison type.


DISTINCT

public static final SqlEnum DISTINCT
Comparison type.


IN

public static final SqlEnum IN
Comparison type.


NOT_IN

public static final SqlEnum NOT_IN
Comparison type.


ALL

public static final SqlEnum ALL
Comparison type.


JOIN

public static final SqlEnum JOIN
Comparison type.


ISNULL

public static final SqlEnum ISNULL
"IS NULL" null comparison


ISNOTNULL

public static final SqlEnum ISNOTNULL
"IS NOT NULL" null comparison


CURRENT_DATE

public static final SqlEnum CURRENT_DATE
"CURRENT_DATE" ANSI SQL function


CURRENT_TIME

public static final SqlEnum CURRENT_TIME
"CURRENT_TIME" ANSI SQL function


LEFT_JOIN

public static final SqlEnum LEFT_JOIN
"LEFT JOIN" SQL statement


RIGHT_JOIN

public static final SqlEnum RIGHT_JOIN
"RIGHT JOIN" SQL statement


INNER_JOIN

public static final SqlEnum INNER_JOIN
"INNER JOIN" SQL statement

Constructor Detail

Criteria

public Criteria()
Creates a new instance with the default capacity.


Criteria

public Criteria(int initialCapacity)
Creates a new instance with the specified capacity.

Parameters:
initialCapacity - An int.

Criteria

public Criteria(java.lang.String dbName)
Creates a new instance with the default capacity which corresponds to the specified database.

Parameters:
dbName - The dabase name.

Criteria

public Criteria(java.lang.String dbName,
                int initialCapacity)
Creates a new instance with the specified capacity which corresponds to the specified database.

Parameters:
dbName - The dabase name.
initialCapacity - The initial capacity.
Method Detail

clear

public void clear()
Brings this criteria back to its initial state, so that it can be reused as if it was new. Except if the criteria has grown in capacity, it is left at the current capacity.

Specified by:
clear in interface java.util.Map
Overrides:
clear in class java.util.Hashtable

addAsColumn

public Criteria addAsColumn(java.lang.String name,
                            java.lang.String clause)
Add an AS clause to the select columns. Usage:

Criteria myCrit = new Criteria(); myCrit.addAsColumn("alias", "ALIAS("+MyPeer.ID+")");

Parameters:
name - wanted Name of the column
clause - SQL clause to select from the table If the name already exists, it is replaced by the new clause.
Returns:
A modified Criteria object.

getAsColumns

public java.util.Map getAsColumns()
Get the column aliases.

Returns:
A Map which map the column alias names to the alias clauses.

getAliases

public java.util.Map getAliases()
Get the table aliases.

Returns:
A Map which maps the table alias names to the actual table names.

addAlias

public void addAlias(java.lang.String alias,
                     java.lang.String table)
Allows one to specify an alias for a table that can be used in various parts of the SQL.

Parameters:
alias - a String value
table - a String value

getTableForAlias

public java.lang.String getTableForAlias(java.lang.String alias)
Returns the table name associated with an alias.

Parameters:
alias - a String value
Returns:
a String value

containsKey

public boolean containsKey(java.lang.String table,
                           java.lang.String column)
Does this Criteria Object contain the specified key?

Parameters:
table - The name of the table.
column - The name of the column.
Returns:
True if this Criteria Object contain the specified key.

getBoolean

public boolean getBoolean(java.lang.String column)
Convenience method to return value as a boolean.

Parameters:
column - String name of column.
Returns:
A boolean.

getBoolean

public boolean getBoolean(java.lang.String table,
                          java.lang.String column)
Convenience method to return value as a boolean.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A boolean.

setUseTransaction

public void setUseTransaction(boolean v)
Will force the sql represented by this criteria to be executed within a transaction. This is here primarily to support the oid type in postgresql. Though it can be used to require any single sql statement to use a transaction.


isUseTransaction

protected boolean isUseTransaction()
called by BasePeer to determine whether the sql command specified by this criteria must be wrapped in a transaction.

Returns:
a boolean value

getCriterion

public Criteria.Criterion getCriterion(java.lang.String column)
Method to return criteria related to columns in a table.

Parameters:
column - String name of column.
Returns:
A Criterion.

getCriterion

public Criteria.Criterion getCriterion(java.lang.String table,
                                       java.lang.String column)
Method to return criteria related to a column in a table.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A Criterion.

getNewCriterion

public Criteria.Criterion getNewCriterion(java.lang.String column,
                                          java.lang.Object value,
                                          SqlEnum comparison)
Method to return criterion that is not added automatically to this Criteria. This can be used to chain the Criterions to form a more complex where clause.

Parameters:
column - String full name of column (for example TABLE.COLUMN).
Returns:
A Criterion.

getNewCriterion

public Criteria.Criterion getNewCriterion(java.lang.String table,
                                          java.lang.String column,
                                          java.lang.Object value,
                                          SqlEnum comparison)
Method to return criterion that is not added automatically to this Criteria. This can be used to chain the Criterions to form a more complex where clause.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A Criterion.

add

public Criteria add(Criteria.Criterion c)
This method adds a prepared Criterion object to the Criteria. You can get a new, empty Criterion object with the getNewCriterion() method. If a criterion for the requested column already exists, it is replaced. This is used as follows:

Criteria crit = new Criteria(); Criteria.Criterion c = crit .getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN); crit.add(c);

Parameters:
c - A Criterion object
Returns:
A modified Criteria object.

getColumnName

public java.lang.String getColumnName(java.lang.String name)
Method to return a String table name.

Parameters:
name - A String with the name of the key.
Returns:
A String with the value of the object at key.

getComparison

public SqlEnum getComparison(java.lang.String key)
Method to return a comparison String.

Parameters:
key - String name of the key.
Returns:
A String with the value of the object at key.

getComparison

public SqlEnum getComparison(java.lang.String table,
                             java.lang.String column)
Method to return a comparison String.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A String with the value of the object at key.

getDate

public java.util.Date getDate(java.lang.String name)
Convenience method to return a Date.

Parameters:
name - column name (TABLE.COLUMN)
Returns:
A java.util.Date with the value of object at key.

getDate

public java.util.Date getDate(java.lang.String table,
                              java.lang.String column)
Convenience method to return a Date.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A java.util.Date with the value of object at key.

getDbName

public java.lang.String getDbName()
Get the Database(Map) name.

Returns:
A String with the Database(Map) name. By default, this is PoolBrokerService.DEFAULT.

setDbName

public void setDbName(java.lang.String dbName)
Set the DatabaseMap name. If null is supplied, uses value provided by Torque.getDefaultDB().

Parameters:
dbName - A String with the Database(Map) name.

getDouble

public double getDouble(java.lang.String name)
Convenience method to return a double.

Parameters:
name - A String with the name of the key.
Returns:
A double with the value of object at key.

getDouble

public double getDouble(java.lang.String table,
                        java.lang.String column)
Convenience method to return a double.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A double with the value of object at key.

getFloat

public float getFloat(java.lang.String name)
Convenience method to return a float.

Parameters:
name - A String with the name of the key.
Returns:
A float with the value of object at key.

getFloat

public float getFloat(java.lang.String table,
                      java.lang.String column)
Convenience method to return a float.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A float with the value of object at key.

getInteger

public java.lang.Integer getInteger(java.lang.String name)
Convenience method to return an Integer.

Parameters:
name - A String with the name of the key.
Returns:
An Integer with the value of object at key.

getInteger

public java.lang.Integer getInteger(java.lang.String table,
                                    java.lang.String column)
Convenience method to return an Integer.

Parameters:
table - String name of table.
column - String name of column.
Returns:
An Integer with the value of object at key.

getInt

public int getInt(java.lang.String name)
Convenience method to return an int.

Parameters:
name - A String with the name of the key.
Returns:
An int with the value of object at key.

getInt

public int getInt(java.lang.String table,
                  java.lang.String column)
Convenience method to return an int.

Parameters:
table - String name of table.
column - String name of column.
Returns:
An int with the value of object at key.

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String name)
Convenience method to return a BigDecimal.

Parameters:
name - A String with the name of the key.
Returns:
A BigDecimal with the value of object at key.

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String table,
                                          java.lang.String column)
Convenience method to return a BigDecimal.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A BigDecimal with the value of object at key.

getLong

public long getLong(java.lang.String name)
Convenience method to return a long.

Parameters:
name - A String with the name of the key.
Returns:
A long with the value of object at key.

getLong

public long getLong(java.lang.String table,
                    java.lang.String column)
Convenience method to return a long.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A long with the value of object at key.

getString

public java.lang.String getString(java.lang.String name)
Convenience method to return a String.

Parameters:
name - A String with the name of the key.
Returns:
A String with the value of object at key.

getString

public java.lang.String getString(java.lang.String table,
                                  java.lang.String column)
Convenience method to return a String.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A String with the value of object at key.

getTableName

public java.lang.String getTableName(java.lang.String name)
Method to return a String table name.

Parameters:
name - A String with the name of the key.
Returns:
A String with the value of object at key.

getList

public java.util.List getList(java.lang.String name)
Convenience method to return a List.

Parameters:
name - A String with the name of the key.
Returns:
A List with the value of object at key.

getList

public java.util.List getList(java.lang.String table,
                              java.lang.String column)
Convenience method to return a List.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A List with the value of object at key.

getValue

public java.lang.Object getValue(java.lang.String name)
Method to return the value that was added to Criteria.

Parameters:
name - A String with the name of the key.
Returns:
An Object with the value of object at key.

getValue

public java.lang.Object getValue(java.lang.String table,
                                 java.lang.String column)
Method to return the value that was added to Criteria.

Parameters:
table - String name of table.
column - String name of column.
Returns:
An Object with the value of object at key.

getObjectKey

public ObjectKey getObjectKey(java.lang.String name)
Convenience method to return an ObjectKey.

Parameters:
name - A String with the name of the key.
Returns:
An ObjectKey with the value of object at key.

getObjectKey

public ObjectKey getObjectKey(java.lang.String table,
                              java.lang.String column)
Convenience method to return an ObjectKey.

Parameters:
table - String name of table.
column - String name of column.
Returns:
A String with the value of object at key.

get

public java.lang.Object get(java.lang.Object key)
Overrides Hashtable get, so that the value placed in the Criterion is returned instead of the Criterion.

Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.Hashtable
Parameters:
key - An Object.
Returns:
An Object.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Overrides Hashtable put, so that this object is returned instead of the value previously in the Criteria object. The reason is so that it more closely matches the behavior of the add() methods. If you want to get the previous value then you should first Criteria.get() it yourself. Note, if you attempt to pass in an Object that is not a String, it will throw a NPE. The reason for this is that none of the add() methods support adding anything other than a String as a key.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.Hashtable
Parameters:
key - An Object. Must be instanceof String!
value - An Object.
Returns:
Instance of self.
Throws:
java.lang.NullPointerException - if key != String or key/value is null.

putAll

public void putAll(java.util.Map t)
Copies all of the mappings from the specified Map to this Criteria These mappings will replace any mappings that this Criteria had for any of the keys currently in the specified Map. if the map was another Criteria, its attributes are copied to this Criteria, overwriting previous settings.

Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class java.util.Hashtable
Parameters:
t - Mappings to be stored in this map.

add

public Criteria add(java.lang.String column,
                    java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is replaced. This is used as follows:

Criteria crit = new Criteria().add("column", "value"); An EQUAL comparison is used for column and value. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the add(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    java.lang.Object value,
                    SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is replaced. If is used as follow:

Criteria crit = new Criteria().add("column", "value" Criteria.GREATER_THAN); Any comparison can be used. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the add(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
comparison - A String.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String table,
                    java.lang.String column,
                    java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is replaced. If is used as follows:

Criteria crit = new Criteria().add("table", "column", "value"); An EQUAL comparison is used for column and value.

Parameters:
table - Name of the table which contains the column
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String table,
                    java.lang.String column,
                    java.lang.Object value,
                    SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is replaced. If is used as follows:

Criteria crit = new Criteria().add("table", "column", "value", Criteria.GREATER_THAN); Any comparison can be used.

Parameters:
table - Name of table which contains the column
column - The column to run the comparison on
value - An Object.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    boolean value)
Convenience method to add a boolean to Criteria. Equal to

add(column, new Boolean(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A Boolean.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    boolean value,
                    SqlEnum comparison)
Convenience method to add a boolean to Criteria. Equal to

add(column, new Boolean(value), comparison);

Parameters:
column - The column to run the comparison on
value - A Boolean.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    int value)
Convenience method to add an int to Criteria. Equal to

add(column, new Integer(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - An int.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    int value,
                    SqlEnum comparison)
Convenience method to add an int to Criteria. Equal to

add(column, new Integer(value), comparison);

Parameters:
column - The column to run the comparison on
value - An int.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    long value)
Convenience method to add a long to Criteria. Equal to

add(column, new Long(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A long.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    long value,
                    SqlEnum comparison)
Convenience method to add a long to Criteria. Equal to

add(column, new Long(value), comparison);

Parameters:
column - The column to run the comparison on
value - A long.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    float value)
Convenience method to add a float to Criteria. Equal to

add(column, new Float(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A float.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    float value,
                    SqlEnum comparison)
Convenience method to add a float to Criteria. Equal to

add(column, new Float(value), comparison);

Parameters:
column - The column to run the comparison on
value - A float.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    double value)
Convenience method to add a double to Criteria. Equal to

add(column, new Double(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A double.
Returns:
A modified Criteria object.

add

public Criteria add(java.lang.String column,
                    double value,
                    SqlEnum comparison)
Convenience method to add a double to Criteria. Equal to

add(column, new Double(value), comparison);

Parameters:
column - The column to run the comparison on
value - A double.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

addDate

public Criteria addDate(java.lang.String column,
                        int year,
                        int month,
                        int date)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

add(column, new GregorianCalendar(year, month,date), EQUAL);

Parameters:
column - A String value to use as column.
year - An int with the year.
month - An int with the month. Month value is 0-based. e.g., 0 for January
date - An int with the date.
Returns:
A modified Criteria object.

addDate

public Criteria addDate(java.lang.String column,
                        int year,
                        int month,
                        int date,
                        SqlEnum comparison)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

add(column, new GregorianCalendar(year, month,date), comparison);

Parameters:
column - The column to run the comparison on
year - An int with the year.
month - An int with the month. Month value is 0-based. e.g., 0 for January
date - An int with the date.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

addJoin

public Criteria addJoin(java.lang.String left,
                        java.lang.String right)
This is the way that you should add a join of two tables. For example:

AND PROJECT.PROJECT_ID=FOO.PROJECT_ID

left = PROJECT.PROJECT_ID right = FOO.PROJECT_ID

Parameters:
left - A String with the left side of the join.
right - A String with the right side of the join.
Returns:
A modified Criteria object.

addJoin

public Criteria addJoin(java.lang.String left,
                        java.lang.String right,
                        SqlEnum operator)
This is the way that you should add a join of two tables. For example:

PROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID=FOO.PROJECT_ID

left = "PROJECT.PROJECT_ID" right = "FOO.PROJECT_ID" operator = Criteria.LEFT_JOIN

Parameters:
left - A String with the left side of the join.
right - A String with the right side of the join.
operator - The operator used for the join: must be one of null, Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN
Returns:
A modified Criteria object.

getJoins

public java.util.List getJoins()
get the List of Joins. This method is meant to be called by BasePeer.

Returns:
a List which contains objects of type Join. If the criteria does not contains any joins, the list is empty

getJoinL

public java.util.List getJoinL()
Deprecated. This method is no longer used by BasePeer.

get one side of the set of possible joins. This method is meant to be called by BasePeer.


getJoinR

public java.util.List getJoinR()
Deprecated. This method is no longer used by BasePeer.

get one side of the set of possible joins. This method is meant to be called by BasePeer.


addIn

public Criteria addIn(java.lang.String column,
                      java.lang.Object[] values)
Adds an 'IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - An Object[] with the allowed values.
Returns:
A modified Criteria object.

addIn

public Criteria addIn(java.lang.String column,
                      int[] values)
Adds an 'IN' clause with the criteria supplied as an int array. For example:

FOO.ID IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - An int[] with the allowed values.
Returns:
A modified Criteria object.

addIn

public Criteria addIn(java.lang.String column,
                      java.util.List values)
Adds an 'IN' clause with the criteria supplied as a List. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - A List with the allowed values.
Returns:
A modified Criteria object.

addNotIn

public Criteria addNotIn(java.lang.String column,
                         java.lang.Object[] values)
Adds a 'NOT IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - An Object[] with the disallowed values.
Returns:
A modified Criteria object.

addNotIn

public Criteria addNotIn(java.lang.String column,
                         int[] values)
Adds a 'NOT IN' clause with the criteria supplied as an int array. For example:

FOO.ID NOT IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - An int[] with the disallowed values.
Returns:
A modified Criteria object.

addNotIn

public Criteria addNotIn(java.lang.String column,
                         java.util.List values)
Adds a 'NOT IN' clause with the criteria supplied as a List. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is replaced.

Parameters:
column - The column to run the comparison on
values - A List with the disallowed values.
Returns:
A modified Criteria object.

setAll

public void setAll()
Adds "ALL " to the SQL statement.


setDistinct

public void setDistinct()
Adds "DISTINCT " to the SQL statement.


setIgnoreCase

public Criteria setIgnoreCase(boolean b)
Sets ignore case.

Parameters:
b - True if case should be ignored.
Returns:
A modified Criteria object.

isIgnoreCase

public boolean isIgnoreCase()
Is ignore case on or off?

Returns:
True if case is ignored.

setSingleRecord

public Criteria setSingleRecord(boolean b)
Set single record? Set this to true if you expect the query to result in only a single result record (the default behaviour is to throw a TorqueException if multiple records are returned when the query is executed). This should be used in situations where returning multiple rows would indicate an error of some sort. If your query might return multiple records but you are only interested in the first one then you should be using setLimit(1).

Parameters:
b - set to true if you expect the query to select just one record.
Returns:
A modified Criteria object.

isSingleRecord

public boolean isSingleRecord()
Is single record?

Returns:
True if a single record is being returned.

setCascade

public Criteria setCascade(boolean b)
Set cascade.

Parameters:
b - True if cascade is set.
Returns:
A modified Criteria object.

isCascade

public boolean isCascade()
Is cascade set?

Returns:
True if cascade is set.

setLimit

public Criteria setLimit(int limit)
Set limit.

Parameters:
limit - An int with the value for limit.
Returns:
A modified Criteria object.

getLimit

public int getLimit()
Get limit.

Returns:
An int with the value for limit.

setOffset

public Criteria setOffset(int offset)
Set offset.

Parameters:
offset - An int with the value for offset.
Returns:
A modified Criteria object.

getOffset

public int getOffset()
Get offset.

Returns:
An int with the value for offset.

addSelectColumn

public Criteria addSelectColumn(java.lang.String name)
Add select column.

Parameters:
name - A String with the name of the select column.
Returns:
A modified Criteria object.

getSelectColumns

public UniqueList getSelectColumns()
Get select columns.

Returns:
An StringStack with the name of the select columns.

getSelectModifiers

public UniqueList getSelectModifiers()
Get select modifiers.

Returns:
An UniqueList with the select modifiers.

addGroupByColumn

public Criteria addGroupByColumn(java.lang.String groupBy)
Add group by column name.

Parameters:
groupBy - The name of the column to group by.
Returns:
A modified Criteria object.

addAscendingOrderByColumn

public Criteria addAscendingOrderByColumn(java.lang.String name)
Add order by column name, explicitly specifying ascending.

Parameters:
name - The name of the column to order by.
Returns:
A modified Criteria object.

addDescendingOrderByColumn

public Criteria addDescendingOrderByColumn(java.lang.String name)
Add order by column name, explicitly specifying descending.

Parameters:
name - The name of the column to order by.
Returns:
A modified Criteria object.

getOrderByColumns

public UniqueList getOrderByColumns()
Get order by columns.

Returns:
An UniqueList with the name of the order columns.

getGroupByColumns

public UniqueList getGroupByColumns()
Get group by columns.

Returns:
An UniqueList with the name of the groupBy clause.

getHaving

public Criteria.Criterion getHaving()
Get Having Criterion.

Returns:
A Criterion that is the having clause.

remove

public java.lang.Object remove(java.lang.String key)
Remove an object from the criteria.

Parameters:
key - A String with the key to be removed.
Returns:
The removed object.

toString

public java.lang.String toString()
Build a string representation of the Criteria.

Overrides:
toString in class java.util.Hashtable
Returns:
A String with the representation of the Criteria.

equals

public boolean equals(java.lang.Object crit)
This method checks another Criteria to see if they contain the same attributes and hashtable entries.

Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.util.Hashtable

hashCode

public int hashCode()
Returns the hash code value for this Join.

Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.util.Hashtable
Returns:
a hash code value for this object.

addHaving

public Criteria addHaving(Criteria.Criterion having)
This method adds a prepared Criterion object to the Criteria as a having clause. You can get a new, empty Criterion object with the getNewCriterion() method.

Criteria crit = new Criteria(); Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN); crit.addHaving(c);

Parameters:
having - A Criterion object
Returns:
A modified Criteria object.

and

public Criteria and(Criteria.Criterion c)
This method adds a prepared Criterion object to the Criteria. You can get a new, empty Criterion object with the getNewCriterion() method. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion. This is used as follows:

Criteria crit = new Criteria(); Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN); crit.and(c);

Parameters:
c - A Criterion object
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion. This is used as follows:

Criteria crit = new Criteria().and("column", "value"); An EQUAL comparison is used for column and value. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the and(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    java.lang.Object value,
                    SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion. If is used as follow:

Criteria crit = new Criteria().and("column", "value" Criteria.GREATER_THAN); Any comparison can be used. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the and(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
comparison - A String.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String table,
                    java.lang.String column,
                    java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion. If is used as follows:

Criteria crit = new Criteria().and("table", "column", "value"); An EQUAL comparison is used for column and value.

Parameters:
table - Name of the table which contains the column
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String table,
                    java.lang.String column,
                    java.lang.Object value,
                    SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion. If is used as follows:

Criteria crit = new Criteria().and("table", "column", "value", "Criterion.GREATER_THAN"); Any comparison can be used.

Parameters:
table - Name of table which contains the column
column - The column to run the comparison on
value - An Object.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    boolean value)
Convenience method to add a boolean to Criteria. Equal to

and(column, new Boolean(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A Boolean.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    boolean value,
                    SqlEnum comparison)
Convenience method to add a boolean to Criteria. Equal to

and(column, new Boolean(value), comparison);

Parameters:
column - The column to run the comparison on
value - A Boolean.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    int value)
Convenience method to add an int to Criteria. Equal to

and(column, new Integer(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - An int.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    int value,
                    SqlEnum comparison)
Convenience method to add an int to Criteria. Equal to

and(column, new Integer(value), comparison);

Parameters:
column - The column to run the comparison on
value - An int.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    long value)
Convenience method to add a long to Criteria. Equal to

and(column, new Long(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A long.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    long value,
                    SqlEnum comparison)
Convenience method to add a long to Criteria. Equal to

and(column, new Long(value), comparison);

Parameters:
column - The column to run the comparison on
value - A long.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    float value)
Convenience method to add a float to Criteria. Equal to

and(column, new Float(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A float.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    float value,
                    SqlEnum comparison)
Convenience method to add a float to Criteria. Equal to

and(column, new Float(value), comparison);

Parameters:
column - The column to run the comparison on
value - A float.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    double value)
Convenience method to add a double to Criteria. Equal to

and(column, new Double(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A double.
Returns:
A modified Criteria object.

and

public Criteria and(java.lang.String column,
                    double value,
                    SqlEnum comparison)
Convenience method to add a double to Criteria. Equal to

and(column, new Double(value), comparison);

Parameters:
column - The column to run the comparison on
value - A double.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

andDate

public Criteria andDate(java.lang.String column,
                        int year,
                        int month,
                        int date)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

and(column, new GregorianCalendar(year, month,date), EQUAL);

Parameters:
column - A String value to use as column.
year - An int with the year.
month - An int with the month.
date - An int with the date.
Returns:
A modified Criteria object.

andDate

public Criteria andDate(java.lang.String column,
                        int year,
                        int month,
                        int date,
                        SqlEnum comparison)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

and(column, new GregorianCalendar(year, month,date), comparison);

Parameters:
column - The column to run the comparison on
year - An int with the year.
month - An int with the month.
date - An int with the date.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

andIn

public Criteria andIn(java.lang.String column,
                      java.lang.Object[] values)
Adds an 'IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An Object[] with the allowed values.
Returns:
A modified Criteria object.

andIn

public Criteria andIn(java.lang.String column,
                      int[] values)
Adds an 'IN' clause with the criteria supplied as an int array. For example:

FOO.ID IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An int[] with the allowed values.
Returns:
A modified Criteria object.

andIn

public Criteria andIn(java.lang.String column,
                      java.util.List values)
Adds an 'IN' clause with the criteria supplied as a List. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - A List with the allowed values.
Returns:
A modified Criteria object.

andNotIn

public Criteria andNotIn(java.lang.String column,
                         java.lang.Object[] values)
Adds a 'NOT IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An Object[] with the disallowed values.
Returns:
A modified Criteria object.

andNotIn

public Criteria andNotIn(java.lang.String column,
                         int[] values)
Adds a 'NOT IN' clause with the criteria supplied as an int array. For example:

FOO.ID NOT IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An int[] with the disallowed values.
Returns:
A modified Criteria object.

andNotIn

public Criteria andNotIn(java.lang.String column,
                         java.util.List values)
Adds a 'NOT IN' clause with the criteria supplied as a List. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "AND"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - A List with the disallowed values.
Returns:
A modified Criteria object.

or

public Criteria or(Criteria.Criterion c)
This method adds a prepared Criterion object to the Criteria. You can get a new, empty Criterion object with the getNewCriterion() method. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. This is used as follows:

Criteria crit = new Criteria(); Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN); crit.or(c);

Parameters:
c - A Criterion object
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. This is used as follows:

Criteria crit = new Criteria().or("column", "value"); An EQUAL comparison is used for column and value. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the or(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   java.lang.Object value,
                   SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. If is used as follow:

Criteria crit = new Criteria().or("column", "value" "Criterion.GREATER_THAN"); Any comparison can be used. The name of the table must be used implicitly in the column name, so the Column name must be something like 'TABLE.id'. If you don't like this, you can use the or(table, column, value) method.

Parameters:
column - The column to run the comparison on
value - An Object.
comparison - A String.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String table,
                   java.lang.String column,
                   java.lang.Object value)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. If is used as follows:

Criteria crit = new Criteria().or("table", "column", "value"); An EQUAL comparison is used for column and value.

Parameters:
table - Name of the table which contains the column
column - The column to run the comparison on
value - An Object.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String table,
                   java.lang.String column,
                   java.lang.Object value,
                   SqlEnum comparison)
This method adds a new criterion to the list of criterias. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion. If is used as follows:

Criteria crit = new Criteria().or("table", "column", "value", "Criterion.GREATER_THAN"); Any comparison can be used.

Parameters:
table - Name of table which contains the column
column - The column to run the comparison on
value - An Object.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   boolean value)
Convenience method to add a boolean to Criteria. Equal to

or(column, new Boolean(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A Boolean.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   boolean value,
                   SqlEnum comparison)
Convenience method to add a boolean to Criteria. Equal to

or(column, new Boolean(value), comparison);

Parameters:
column - The column to run the comparison on
value - A Boolean.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   int value)
Convenience method to add an int to Criteria. Equal to

or(column, new Integer(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - An int.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   int value,
                   SqlEnum comparison)
Convenience method to add an int to Criteria. Equal to

or(column, new Integer(value), comparison);

Parameters:
column - The column to run the comparison on
value - An int.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   long value)
Convenience method to add a long to Criteria. Equal to

or(column, new Long(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A long.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   long value,
                   SqlEnum comparison)
Convenience method to add a long to Criteria. Equal to

or(column, new Long(value), comparison);

Parameters:
column - The column to run the comparison on
value - A long.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   float value)
Convenience method to add a float to Criteria. Equal to

or(column, new Float(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A float.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   float value,
                   SqlEnum comparison)
Convenience method to add a float to Criteria. Equal to

or(column, new Float(value), comparison);

Parameters:
column - The column to run the comparison on
value - A float.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   double value)
Convenience method to add a double to Criteria. Equal to

or(column, new Double(value), EQUAL);

Parameters:
column - The column to run the comparison on
value - A double.
Returns:
A modified Criteria object.

or

public Criteria or(java.lang.String column,
                   double value,
                   SqlEnum comparison)
Convenience method to add a double to Criteria. Equal to

or(column, new Double(value), comparison);

Parameters:
column - The column to run the comparison on
value - A double.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

orDate

public Criteria orDate(java.lang.String column,
                       int year,
                       int month,
                       int date)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

or(column, new GregorianCalendar(year, month,date), EQUAL);

Parameters:
column - A String value to use as column.
year - An int with the year.
month - An int with the month.
date - An int with the date.
Returns:
A modified Criteria object.

orDate

public Criteria orDate(java.lang.String column,
                       int year,
                       int month,
                       int date,
                       SqlEnum comparison)
Convenience method to add a Date object specified by year, month, and date into the Criteria. Equal to

or(column, new GregorianCalendar(year, month,date), comparison);

Parameters:
column - The column to run the comparison on
year - An int with the year.
month - An int with the month.
date - An int with the date.
comparison - String describing how to compare the column with the value
Returns:
A modified Criteria object.

orIn

public Criteria orIn(java.lang.String column,
                     java.lang.Object[] values)
Adds an 'IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An Object[] with the allowed values.
Returns:
A modified Criteria object.

orIn

public Criteria orIn(java.lang.String column,
                     int[] values)
Adds an 'IN' clause with the criteria supplied as an int array. For example:

FOO.ID IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An int[] with the allowed values.
Returns:
A modified Criteria object.

orIn

public Criteria orIn(java.lang.String column,
                     java.util.List values)
Adds an 'IN' clause with the criteria supplied as a List. For example:

FOO.NAME IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - A List with the allowed values.
Returns:
A modified Criteria object.

orNotIn

public Criteria orNotIn(java.lang.String column,
                        java.lang.Object[] values)
Adds a 'NOT IN' clause with the criteria supplied as an Object array. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An Object[] with the disallowed values.
Returns:
A modified Criteria object.

orNotIn

public Criteria orNotIn(java.lang.String column,
                        int[] values)
Adds a 'NOT IN' clause with the criteria supplied as an int array. For example:

FOO.ID NOT IN ('2', '3', '7')

where 'values' contains those three integers. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - An int[] with the disallowed values.
Returns:
A modified Criteria object.

orNotIn

public Criteria orNotIn(java.lang.String column,
                        java.util.List values)
Adds a 'NOT IN' clause with the criteria supplied as a List. For example:

FOO.NAME NOT IN ('FOO', 'BAR', 'ZOW')

where 'values' contains three objects that evaluate to the respective strings above when .toString() is called. If a criterion for the requested column already exists, it is "OR"ed to the existing criterion.

Parameters:
column - The column to run the comparison on
values - A List with the disallowed values.
Returns:
A modified Criteria object.


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.