|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable org.apache.torque.util.Criteria
public class Criteria
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.
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 |
---|
public static final SqlEnum EQUAL
public static final SqlEnum NOT_EQUAL
public static final SqlEnum ALT_NOT_EQUAL
public static final SqlEnum GREATER_THAN
public static final SqlEnum LESS_THAN
public static final SqlEnum GREATER_EQUAL
public static final SqlEnum LESS_EQUAL
public static final SqlEnum LIKE
public static final SqlEnum NOT_LIKE
public static final SqlEnum ILIKE
public static final SqlEnum NOT_ILIKE
public static final SqlEnum CUSTOM
public static final SqlEnum DISTINCT
public static final SqlEnum IN
public static final SqlEnum NOT_IN
public static final SqlEnum ALL
public static final SqlEnum JOIN
public static final SqlEnum ISNULL
public static final SqlEnum ISNOTNULL
public static final SqlEnum CURRENT_DATE
public static final SqlEnum CURRENT_TIME
public static final SqlEnum LEFT_JOIN
public static final SqlEnum RIGHT_JOIN
public static final SqlEnum INNER_JOIN
Constructor Detail |
---|
public Criteria()
public Criteria(int initialCapacity)
initialCapacity
- An int.public Criteria(java.lang.String dbName)
dbName
- The dabase name.public Criteria(java.lang.String dbName, int initialCapacity)
dbName
- The dabase name.initialCapacity
- The initial capacity.Method Detail |
---|
public void clear()
clear
in interface java.util.Map
clear
in class java.util.Hashtable
public Criteria addAsColumn(java.lang.String name, java.lang.String clause)
Criteria myCrit = new Criteria();
myCrit.addAsColumn("alias", "ALIAS("+MyPeer.ID+")");
name
- wanted Name of the columnclause
- SQL clause to select from the table
If the name already exists, it is replaced by the new clause.
public java.util.Map getAsColumns()
public java.util.Map getAliases()
public void addAlias(java.lang.String alias, java.lang.String table)
alias
- a String
valuetable
- a String
valuepublic java.lang.String getTableForAlias(java.lang.String alias)
alias
- a String
value
String
valuepublic boolean containsKey(java.lang.String table, java.lang.String column)
table
- The name of the table.column
- The name of the column.
public boolean getBoolean(java.lang.String column)
column
- String name of column.
public boolean getBoolean(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public void setUseTransaction(boolean v)
protected boolean isUseTransaction()
boolean
valuepublic Criteria.Criterion getCriterion(java.lang.String column)
column
- String name of column.
public Criteria.Criterion getCriterion(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public Criteria.Criterion getNewCriterion(java.lang.String column, java.lang.Object value, SqlEnum comparison)
column
- String full name of column (for example TABLE.COLUMN).
public Criteria.Criterion getNewCriterion(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
table
- String name of table.column
- String name of column.
public Criteria add(Criteria.Criterion c)
Criteria crit = new Criteria();
Criteria.Criterion c = crit
.getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN);
crit.add(c);
c
- A Criterion object
public java.lang.String getColumnName(java.lang.String name)
name
- A String with the name of the key.
public SqlEnum getComparison(java.lang.String key)
key
- String name of the key.
public SqlEnum getComparison(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.util.Date getDate(java.lang.String name)
name
- column name (TABLE.COLUMN)
public java.util.Date getDate(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.String getDbName()
public void setDbName(java.lang.String dbName)
null
is supplied, uses value
provided by Torque.getDefaultDB()
.
dbName
- A String with the Database(Map) name.public double getDouble(java.lang.String name)
name
- A String with the name of the key.
public double getDouble(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public float getFloat(java.lang.String name)
name
- A String with the name of the key.
public float getFloat(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.Integer getInteger(java.lang.String name)
name
- A String with the name of the key.
public java.lang.Integer getInteger(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public int getInt(java.lang.String name)
name
- A String with the name of the key.
public int getInt(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.math.BigDecimal getBigDecimal(java.lang.String name)
name
- A String with the name of the key.
public java.math.BigDecimal getBigDecimal(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public long getLong(java.lang.String name)
name
- A String with the name of the key.
public long getLong(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.String getString(java.lang.String name)
name
- A String with the name of the key.
public java.lang.String getString(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.String getTableName(java.lang.String name)
name
- A String with the name of the key.
public java.util.List getList(java.lang.String name)
name
- A String with the name of the key.
public java.util.List getList(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.Object getValue(java.lang.String name)
name
- A String with the name of the key.
public java.lang.Object getValue(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public ObjectKey getObjectKey(java.lang.String name)
name
- A String with the name of the key.
public ObjectKey getObjectKey(java.lang.String table, java.lang.String column)
table
- String name of table.column
- String name of column.
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
get
in class java.util.Hashtable
key
- An Object.
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
put
in class java.util.Hashtable
key
- An Object. Must be instanceof String!value
- An Object.
java.lang.NullPointerException
- if key != String or key/value is null.public void putAll(java.util.Map t)
putAll
in interface java.util.Map
putAll
in class java.util.Hashtable
t
- Mappings to be stored in this map.public Criteria add(java.lang.String column, java.lang.Object value)
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.
column
- The column to run the comparison onvalue
- An Object.
public Criteria add(java.lang.String column, java.lang.Object value, SqlEnum comparison)
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.
column
- The column to run the comparison onvalue
- An Object.comparison
- A String.
public Criteria add(java.lang.String table, java.lang.String column, java.lang.Object value)
Criteria crit = new Criteria().add("table",
"column",
"value");
An EQUAL comparison is used for column and value.
table
- Name of the table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.
public Criteria add(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
Criteria crit = new Criteria().add("table",
"column",
"value",
Criteria.GREATER_THAN);
Any comparison can be used.
table
- Name of table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.comparison
- String describing how to compare the column with
the value
public Criteria add(java.lang.String column, boolean value)
add(column, new Boolean(value), EQUAL);
column
- The column to run the comparison onvalue
- A Boolean.
public Criteria add(java.lang.String column, boolean value, SqlEnum comparison)
add(column, new Boolean(value), comparison);
column
- The column to run the comparison onvalue
- A Boolean.comparison
- String describing how to compare the column with
the value
public Criteria add(java.lang.String column, int value)
add(column, new Integer(value), EQUAL);
column
- The column to run the comparison onvalue
- An int.
public Criteria add(java.lang.String column, int value, SqlEnum comparison)
add(column, new Integer(value), comparison);
column
- The column to run the comparison onvalue
- An int.comparison
- String describing how to compare the column with
the value
public Criteria add(java.lang.String column, long value)
add(column, new Long(value), EQUAL);
column
- The column to run the comparison onvalue
- A long.
public Criteria add(java.lang.String column, long value, SqlEnum comparison)
add(column, new Long(value), comparison);
column
- The column to run the comparison onvalue
- A long.comparison
- String describing how to compare the column with
the value
public Criteria add(java.lang.String column, float value)
add(column, new Float(value), EQUAL);
column
- The column to run the comparison onvalue
- A float.
public Criteria add(java.lang.String column, float value, SqlEnum comparison)
add(column, new Float(value), comparison);
column
- The column to run the comparison onvalue
- A float.comparison
- String describing how to compare the column with
the value
public Criteria add(java.lang.String column, double value)
add(column, new Double(value), EQUAL);
column
- The column to run the comparison onvalue
- A double.
public Criteria add(java.lang.String column, double value, SqlEnum comparison)
add(column, new Double(value), comparison);
column
- The column to run the comparison onvalue
- A double.comparison
- String describing how to compare the column with
the value
public Criteria addDate(java.lang.String column, int year, int month, int date)
add(column, new GregorianCalendar(year, month,date), EQUAL);
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 Januarydate
- An int with the date.
public Criteria addDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
add(column, new GregorianCalendar(year, month,date), comparison);
column
- The column to run the comparison onyear
- An int with the year.month
- An int with the month. Month value is 0-based.
e.g., 0 for Januarydate
- An int with the date.comparison
- String describing how to compare the column with
the value
public Criteria addJoin(java.lang.String left, java.lang.String right)
AND PROJECT.PROJECT_ID=FOO.PROJECT_ID
left = PROJECT.PROJECT_ID right = FOO.PROJECT_ID
left
- A String with the left side of the join.right
- A String with the right side of the join.
public Criteria addJoin(java.lang.String left, java.lang.String right, SqlEnum operator)
PROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID=FOO.PROJECT_ID
left = "PROJECT.PROJECT_ID" right = "FOO.PROJECT_ID" operator = Criteria.LEFT_JOIN
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
public java.util.List getJoins()
public java.util.List getJoinL()
public java.util.List getJoinR()
public Criteria addIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the allowed values.
public Criteria addIn(java.lang.String column, int[] values)
FOO.ID IN ('2', '3', '7')
where 'values' contains those three integers. If a criterion for the requested column already exists, it is replaced.
column
- The column to run the comparison onvalues
- An int[] with the allowed values.
public Criteria addIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the allowed values.
public Criteria addNotIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the disallowed values.
public Criteria addNotIn(java.lang.String column, int[] values)
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.
column
- The column to run the comparison onvalues
- An int[] with the disallowed values.
public Criteria addNotIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the disallowed values.
public void setAll()
public void setDistinct()
public Criteria setIgnoreCase(boolean b)
b
- True if case should be ignored.
public boolean isIgnoreCase()
public Criteria setSingleRecord(boolean b)
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).
b
- set to true
if you expect the query to select just
one record.
public boolean isSingleRecord()
public Criteria setCascade(boolean b)
b
- True if cascade is set.
public boolean isCascade()
public Criteria setLimit(int limit)
limit
- An int with the value for limit.
public int getLimit()
public Criteria setOffset(int offset)
offset
- An int with the value for offset.
public int getOffset()
public Criteria addSelectColumn(java.lang.String name)
name
- A String with the name of the select column.
public UniqueList getSelectColumns()
public UniqueList getSelectModifiers()
public Criteria addGroupByColumn(java.lang.String groupBy)
groupBy
- The name of the column to group by.
public Criteria addAscendingOrderByColumn(java.lang.String name)
name
- The name of the column to order by.
public Criteria addDescendingOrderByColumn(java.lang.String name)
name
- The name of the column to order by.
public UniqueList getOrderByColumns()
public UniqueList getGroupByColumns()
public Criteria.Criterion getHaving()
public java.lang.Object remove(java.lang.String key)
key
- A String with the key to be removed.
public java.lang.String toString()
toString
in class java.util.Hashtable
public boolean equals(java.lang.Object crit)
equals
in interface java.util.Map
equals
in class java.util.Hashtable
public int hashCode()
hashCode
in interface java.util.Map
hashCode
in class java.util.Hashtable
public Criteria addHaving(Criteria.Criterion having)
Criteria crit = new Criteria();
Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5),
Criteria.LESS_THAN);
crit.addHaving(c);
having
- A Criterion object
public Criteria and(Criteria.Criterion c)
Criteria crit = new Criteria();
Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5),
Criteria.LESS_THAN);
crit.and(c);
c
- A Criterion object
public Criteria and(java.lang.String column, java.lang.Object value)
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.
column
- The column to run the comparison onvalue
- An Object.
public Criteria and(java.lang.String column, java.lang.Object value, SqlEnum comparison)
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.
column
- The column to run the comparison onvalue
- An Object.comparison
- A String.
public Criteria and(java.lang.String table, java.lang.String column, java.lang.Object value)
Criteria crit = new Criteria().and("table",
"column",
"value");
An EQUAL comparison is used for column and value.
table
- Name of the table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.
public Criteria and(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
Criteria crit = new Criteria().and("table",
"column",
"value",
"Criterion.GREATER_THAN");
Any comparison can be used.
table
- Name of table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.comparison
- String describing how to compare the column with
the value
public Criteria and(java.lang.String column, boolean value)
and(column, new Boolean(value), EQUAL);
column
- The column to run the comparison onvalue
- A Boolean.
public Criteria and(java.lang.String column, boolean value, SqlEnum comparison)
and(column, new Boolean(value), comparison);
column
- The column to run the comparison onvalue
- A Boolean.comparison
- String describing how to compare the column
with the value
public Criteria and(java.lang.String column, int value)
and(column, new Integer(value), EQUAL);
column
- The column to run the comparison onvalue
- An int.
public Criteria and(java.lang.String column, int value, SqlEnum comparison)
and(column, new Integer(value), comparison);
column
- The column to run the comparison onvalue
- An int.comparison
- String describing how to compare the column with the value
public Criteria and(java.lang.String column, long value)
and(column, new Long(value), EQUAL);
column
- The column to run the comparison onvalue
- A long.
public Criteria and(java.lang.String column, long value, SqlEnum comparison)
and(column, new Long(value), comparison);
column
- The column to run the comparison onvalue
- A long.comparison
- String describing how to compare the column with
the value
public Criteria and(java.lang.String column, float value)
and(column, new Float(value), EQUAL);
column
- The column to run the comparison onvalue
- A float.
public Criteria and(java.lang.String column, float value, SqlEnum comparison)
and(column, new Float(value), comparison);
column
- The column to run the comparison onvalue
- A float.comparison
- String describing how to compare the column with
the value
public Criteria and(java.lang.String column, double value)
and(column, new Double(value), EQUAL);
column
- The column to run the comparison onvalue
- A double.
public Criteria and(java.lang.String column, double value, SqlEnum comparison)
and(column, new Double(value), comparison);
column
- The column to run the comparison onvalue
- A double.comparison
- String describing how to compare the column with
the value
public Criteria andDate(java.lang.String column, int year, int month, int date)
and(column, new GregorianCalendar(year, month,date), EQUAL);
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.
public Criteria andDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
and(column, new GregorianCalendar(year, month,date), comparison);
column
- The column to run the comparison onyear
- 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
public Criteria andIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the allowed values.
public Criteria andIn(java.lang.String column, int[] values)
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.
column
- The column to run the comparison onvalues
- An int[] with the allowed values.
public Criteria andIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the allowed values.
public Criteria andNotIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the disallowed values.
public Criteria andNotIn(java.lang.String column, int[] values)
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.
column
- The column to run the comparison onvalues
- An int[] with the disallowed values.
public Criteria andNotIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the disallowed values.
public Criteria or(Criteria.Criterion c)
Criteria crit = new Criteria();
Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5), Criteria.LESS_THAN);
crit.or(c);
c
- A Criterion object
public Criteria or(java.lang.String column, java.lang.Object value)
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.
column
- The column to run the comparison onvalue
- An Object.
public Criteria or(java.lang.String column, java.lang.Object value, SqlEnum comparison)
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.
column
- The column to run the comparison onvalue
- An Object.comparison
- A String.
public Criteria or(java.lang.String table, java.lang.String column, java.lang.Object value)
Criteria crit = new Criteria().or("table",
"column",
"value");
An EQUAL comparison is used for column and value.
table
- Name of the table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.
public Criteria or(java.lang.String table, java.lang.String column, java.lang.Object value, SqlEnum comparison)
Criteria crit = new Criteria().or("table",
"column",
"value",
"Criterion.GREATER_THAN");
Any comparison can be used.
table
- Name of table which contains the columncolumn
- The column to run the comparison onvalue
- An Object.comparison
- String describing how to compare the column with the value
public Criteria or(java.lang.String column, boolean value)
or(column, new Boolean(value), EQUAL);
column
- The column to run the comparison onvalue
- A Boolean.
public Criteria or(java.lang.String column, boolean value, SqlEnum comparison)
or(column, new Boolean(value), comparison);
column
- The column to run the comparison onvalue
- A Boolean.comparison
- String describing how to compare the column
with the value
public Criteria or(java.lang.String column, int value)
or(column, new Integer(value), EQUAL);
column
- The column to run the comparison onvalue
- An int.
public Criteria or(java.lang.String column, int value, SqlEnum comparison)
or(column, new Integer(value), comparison);
column
- The column to run the comparison onvalue
- An int.comparison
- String describing how to compare the column
with the value
public Criteria or(java.lang.String column, long value)
or(column, new Long(value), EQUAL);
column
- The column to run the comparison onvalue
- A long.
public Criteria or(java.lang.String column, long value, SqlEnum comparison)
or(column, new Long(value), comparison);
column
- The column to run the comparison onvalue
- A long.comparison
- String describing how to compare the column
with the value
public Criteria or(java.lang.String column, float value)
or(column, new Float(value), EQUAL);
column
- The column to run the comparison onvalue
- A float.
public Criteria or(java.lang.String column, float value, SqlEnum comparison)
or(column, new Float(value), comparison);
column
- The column to run the comparison onvalue
- A float.comparison
- String describing how to compare the column
with the value
public Criteria or(java.lang.String column, double value)
or(column, new Double(value), EQUAL);
column
- The column to run the comparison onvalue
- A double.
public Criteria or(java.lang.String column, double value, SqlEnum comparison)
or(column, new Double(value), comparison);
column
- The column to run the comparison onvalue
- A double.comparison
- String describing how to compare the column
with the value
public Criteria orDate(java.lang.String column, int year, int month, int date)
or(column, new GregorianCalendar(year, month,date), EQUAL);
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.
public Criteria orDate(java.lang.String column, int year, int month, int date, SqlEnum comparison)
or(column, new GregorianCalendar(year, month,date), comparison);
column
- The column to run the comparison onyear
- 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
public Criteria orIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the allowed values.
public Criteria orIn(java.lang.String column, int[] values)
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.
column
- The column to run the comparison onvalues
- An int[] with the allowed values.
public Criteria orIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the allowed values.
public Criteria orNotIn(java.lang.String column, java.lang.Object[] values)
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.
column
- The column to run the comparison onvalues
- An Object[] with the disallowed values.
public Criteria orNotIn(java.lang.String column, int[] values)
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.
column
- The column to run the comparison onvalues
- An int[] with the disallowed values.
public Criteria orNotIn(java.lang.String column, java.util.List values)
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.
column
- The column to run the comparison onvalues
- A List with the disallowed values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |