Klasse Criteria
- Alle implementierten Schnittstellen:
Serializable
,Cloneable
- Version:
- $Id: Criteria.java 1912421 2023-09-20 07:49:04Z gk $
- Autor:
- Frank Y. Kim, John D. McNally, Brett McLaughlin, Eric Dobbs, Henning P. Schmiedehausen, Sam Joseph, Martin Poeschl, Thomas Fischer, Scott Eade, Thomas Vandahl
- Siehe auch:
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
"CURRENT_DATE" ANSI SQL functionstatic final SqlEnum
"CURRENT_TIME" ANSI SQL functionstatic final SqlEnum
"CURRENT_TIMESTAMP" ANSI SQL functionstatic final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final JoinType
"INNER JOIN" SQL statementstatic final SqlEnum
"IS NOT NULL" null comparisonstatic final SqlEnum
"IS NULL" null comparisonstatic final SqlEnum
Comparison type.static final JoinType
"LEFT JOIN" SQL statementstatic final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final SqlEnum
Comparison type.static final JoinType
"RIGHT JOIN" SQL statement -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungAllows one to specify an alias for a table.Allows one to specify an alias for a subselect.addAscendingOrderByColumn
(Column column) Adds an order by clause, explicitly specifying ascending.addAscendingOrderByColumn
(Column column, boolean ignoreCase) Add an order by clause, explicitly specifying ascending.addAsColumn
(String name, Column clause) Add an AS clause to the select columns.addDescendingOrderByColumn
(Column column) Add order by column name, explicitly specifying descending.addDescendingOrderByColumn
(Column column, boolean ignoreCase) Add order by column name, explicitly specifying descending.Adds a table to the from clause, not using a joinType or joinCondition.addFrom
(FromElement fromElement) Adds a new Element to the from clause.addGroupByColumn
(Column groupBy) Add a group by clause.This method adds a prepared Criterion object to the Criteria as a having clause.Adds a join to the criteria.Adds a join to the criteria, E.g. to create the conditionAdds a join to the criteria, E.g. to create the conditionAdds a join to the criteria, E.g. to create the conditionaddJoin
(PreparedStatementPart leftTable, PreparedStatementPart rightTable, Criterion joinCondition, JoinType joinType) Adds a join to the criteria, E.g. to create the conditionaddSelectColumn
(Column column) Adds a select column to the Criteria."AND"s a new condition with the conditions in this Criteria."AND"s a new condition with the conditions in this Criteria."AND"s Criterion object with the conditions in this Criteria.Convenience method to AND a new date comparison with the conditions in this Criteria.Convenience method to AND a new date comparison with the conditions in this Criteria.Convenience method to AND a "in" comparison with the conditions in this Criteria.andIn
(Object lValue, Collection<?> rValues) Convenience method to AND a "in" comparison with the conditions in this Criteria.Convenience method to AND a "not in" comparison with the conditions in this Criteria.andNotIn
(Object lValue, Collection<?> rValues) Convenience method to AND a "not in" comparison with the conditions in this Criteria.andVerbatimSql
(String sql, Object[] replacements) Ands a verbatim sql condition to this Criteria.andVerbatimSql
(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) ANDs a verbatim sql condition to this Criteria.protected void
appendSetOperation
(Criteria other, SqlEnum setOperator) Appends a set operation (union, except, intersect) to this Criteria.protected void
Checks that this Criteria is no composite Criteria, and throws a TorqueRuntimeException otherwise.protected void
clear()
Resets this Criteria to its original state.clone()
Returns a shallow copy of this object.boolean
Checks whether an object is equal to this Criteria.Creates a SQL EXCEPT between this Criteria and the passed other criteria.Creates a SQL EXCEPT between this Criteria and the passed other criteria.Sets that FOR UPDATE clause should be added to the query.Get the table aliases.Get the column aliases.Get the Database name to be used for this criterion.Returns the JDBC statement fetch size to use for queries.Get all elements in the from clause of the query.Get all group by columns.Get Having Criterion.getJoins()
Get the List of Joins.int
getLimit()
Get the upper limit for the number of records returned by a query.long
Get how many records should be skipped at the start of the result.Get all order by columns.Return all select columns.Return all select modifiers.Return the parts of the criteria which compose a query using set operations (union, except, intersect).Returns the operator between the set operations.getSubselectForAlias
(String alias) Returns the subselect associated with an alias.getTableForAlias
(String alias) Returns the database table name associated with an alias.Returns the top level Criterion.int
hashCode()
Returns the hash code value for this Criteria.Creates a SQL INTERSECT between this Criteria and the passed other criteria.intersectAll
(Criteria other) Creates a SQL INTERSECT ALL between this Criteria and the passed other criteria.boolean
Returns whether this Criteria is a composite criteria, i.e. is composed from more than one Criteria related by set operations (e.g. union, except, intersect)..boolean
Returns whether a FOR UPDATE clause is added.boolean
Returns whether case should be ignored in where clauses and order by whenever String columns are encountered.boolean
Returns whether the check that a query returns exactly one record is active."OR"s a new condition with the conditions in this Criteria."OR"s a new condition with the conditions in this Criteria."OR"s a Criterion object with the conditions in this Criteria.Convenience method to OR a new date comparison with the conditions in this Criteria.Convenience method to OR a new date comparison with the conditions in this Criteria.Convenience method to OR a "in" comparison with the conditions in this Criteria.orIn
(Object lValue, Collection<?> rValues) Convenience method to OR a "in" comparison with the conditions in this Criteria.Convenience method to OR a "not in" comparison with the conditions in this Criteria.orNotIn
(Object lValue, Collection<?> rValues) Convenience method to OR a "not in" comparison with the conditions in this Criteria.orVerbatimSql
(String sql, Object[] replacements) ORs a verbatim sql condition to this Criteria.orVerbatimSql
(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) ORs a verbatim sql condition to this Criteria.setAll()
Adds "ALL " to the SQL statement.Set the Database name.Adds "DISTINCT " to the SQL statement.setFetchSize
(Integer fetchSize) Sets the JDBC statement fetch size to use for queries.setForUpdate
(boolean forUpdate) Sets whether FOR UPDATE clause should be added to the query.setIgnoreCase
(boolean ignoreCase) Sets whether case should be ignored in where clauses and order by whenever String columns are encountered.setLimit
(int limit) Set a limit for the querysetOffset
(long offset) Set the offset.setSingleRecord
(boolean b) Switch the check on or off that a query returns exactly one record.toString()
Build a string representation of the Criteria for debugging purposes.Creates a SQL UNION between this Criteria and the passed other criteria.Creates a SQL UNION ALL between this Criteria and the passed other criteria."AND"s a new condition with the conditions in this Criteria."AND"s a new condition with the conditions in this Criteria."AND"s Criterion object with the conditions in this Criteria.Convenience method to AND a new date comparison with the conditions in this Criteria.Convenience method to AND a new date comparison with the conditions in this Criteria.Convenience method to AND a "in" comparison with the conditions in this Criteria.whereIn
(Object lValue, Collection<?> rValues) Convenience method to AND a "in" comparison with the conditions in this Criteria.whereNotIn
(Object lValue, Object[] rValues) Convenience method to AND a "not in" comparison with the conditions in this Criteria.whereNotIn
(Object lValue, Collection<?> rValues) Convenience method to AND a "not in" comparison with the conditions in this Criteria.whereVerbatimSql
(String sql, Object[] replacements) Convenience method to AND a verbatim sql condition to this Criteria.whereVerbatimSql
(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) Convenience method to AND a verbatim sql condition to this Criteria.
-
Felddetails
-
EQUAL
Comparison type. -
NOT_EQUAL
Comparison type. -
ALT_NOT_EQUAL
Comparison type. -
GREATER_THAN
Comparison type. -
LESS_THAN
Comparison type. -
GREATER_EQUAL
Comparison type. -
LESS_EQUAL
Comparison type. -
LIKE
Comparison type. -
NOT_LIKE
Comparison type. -
ILIKE
Comparison type. -
NOT_ILIKE
Comparison type. -
DISTINCT
Comparison type. -
IN
Comparison type. -
NOT_IN
Comparison type. -
ALL
Comparison type. -
JOIN
Comparison type. -
ISNULL
"IS NULL" null comparison -
ISNOTNULL
"IS NOT NULL" null comparison -
CURRENT_DATE
"CURRENT_DATE" ANSI SQL function -
CURRENT_TIME
"CURRENT_TIME" ANSI SQL function -
CURRENT_TIMESTAMP
"CURRENT_TIMESTAMP" ANSI SQL function -
LEFT_JOIN
"LEFT JOIN" SQL statement -
RIGHT_JOIN
"RIGHT JOIN" SQL statement -
INNER_JOIN
"INNER JOIN" SQL statement
-
-
Konstruktordetails
-
Criteria
public Criteria()Constructor. -
Criteria
Constructor with the database name as parameter..- Parameter:
dbName
- The database name.
-
Criteria
Copy-constructor. The copy is deep insofar as all contained lists are copied, however the elements contained in the list are not copied.- Parameter:
toCopy
- the criteria to copy.
-
-
Methodendetails
-
clear
protected void clear()Resets this Criteria to its original state. -
addAsColumn
Add an AS clause to the select columns. Usage:Criteria myCrit = new Criteria(); myCrit.addAsColumn( "alias", "ALIAS("+MyPeer.ID+")");
If the name already exists, it is replaced by the new clause.- Parameter:
name
- wanted Name of the columnclause
- SQL clause to select from the table- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getAsColumns
Get the column aliases.- Gibt zurück:
- A Map which map the column alias names to the alias clauses.
-
getAliases
Get the table aliases.- Gibt zurück:
- A Map which maps the table alias names to either the actual table names (String) or to a subselect (Criteria).
-
addAlias
Allows one to specify an alias for a table.- Parameter:
alias
- the alias for the table name.table
- the table name as known in the database.- Gibt zurück:
- the Criteria object
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addAlias
Allows one to specify an alias for a subselect.- Parameter:
alias
- the alias for the subselect.subselect
- the Criteria for the subselect.- Gibt zurück:
- the Criteria object
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getTableForAlias
Returns the database table name associated with an alias.- Parameter:
alias
- aString
value.- Gibt zurück:
- a
String
value, or null if the alias is not defined. - Löst aus:
IllegalArgumentException
- if the alias with the namealias
is defined but is no alias for a table name (e.g. it is an alias for a subselect).
-
getSubselectForAlias
Returns the subselect associated with an alias.- Parameter:
alias
- aString
value.- Gibt zurück:
- a
String
value, or null if the alias is not defined. - Löst aus:
IllegalArgumentException
- if the alias with the namealias
is defined but is not an alias for a subselect (e.g. it is an alias for a table).
-
getTopLevelCriterion
Returns the top level Criterion.- Gibt zurück:
- the top level Criterion, or null if no Criterion is contained.
-
getDbName
Get the Database name to be used for this criterion.- Gibt zurück:
- The database name, may be null.
-
setDbName
Set the Database name. The valuenull
denotes the database name provided byTorque.getDefaultDB()
(but this is not resolved here).- Parameter:
dbName
- The Database(Map) name.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addHaving
This method adds a prepared Criterion object to the Criteria as a having clause. Usage:Criteria crit = new Criteria(); Criterion c =new Criterion(MyPeer.ID, 5, Criteria.LESS_THAN); crit.addHaving(c);
- Parameter:
having
- A Criterion object- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getHaving
Get Having Criterion.- Gibt zurück:
- A Criterion that is the having clause.
-
forUpdate
Sets that FOR UPDATE clause should be added to the query.- Gibt zurück:
- this object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
setForUpdate
Sets whether FOR UPDATE clause should be added to the query.- Parameter:
forUpdate
- true if a FOR UPDATE clause should be added, false if not.- Gibt zurück:
- this object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
isForUpdate
public boolean isForUpdate()Returns whether a FOR UPDATE clause is added.- Gibt zurück:
- true if a FOR UPDATE clause is added, false otherwise.
-
addJoin
Adds a join to the criteria, E.g. to create the conditionAND PROJECT.PROJECT_ID=FOO.PROJECT_ID
use
criteria.addJoin(ProjectPeer.PROJECT_ID, FooPeer.PROJECT_ID)
- Parameter:
left
- A String with the left side of the join.right
- A String with the right side of the join.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addJoin
Adds a join to the criteria, E.g. to create the conditionPROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID=FOO.PROJECT_ID
use
criteria.addJoin(ProjectPeer.PROJECT_ID, FooPeer.PROJECT_ID, Criteria.LEFT_JOIN);
- Parameter:
left
- A String with the left side of the join.right
- A String with the right side of the join.joinType
- The operator used for the join: must be one of null, Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addJoin
Adds a join to the criteria, E.g. to create the conditionPROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID <> FOO.PROJECT_ID
use
criteria.addJoin( ProjectPeer.PROJECT_ID, Criteria.NOT_EQUAL, FooPeer.PROJECT_ID, Criteria.LEFT_JOIN);
- Parameter:
left
- A String with the left side of the join condition.right
- A String with the right side of the join condition.comparison
- the comparison operator, not null. The operator CUSTOM is not supported.joinType
- The operator used for the join. Must be one of null, Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addJoin
public Criteria addJoin(String leftTable, String rightTable, Criterion joinCondition, JoinType joinType) Adds a join to the criteria. For creating standard joins, please use addJoin(Column, Column, (SqlEnum, ) JoinType)PROJECT LEFT JOIN FOO ON (PROJECT.PROJECT_ID=FOO.PROJECT_ID OR PROJECT.PROJECT_ID==FOO.PROJECT2_ID)
use
criteria.addJoin( ProjectPeer.TABLE_NAME, FooPeer.TABLE_NAME, new Criterion(ProjectPeer.PROJECT_ID, FooPeer.PROJECT_ID) .or(Criterion(ProjectPeer.PROJECT_ID, FooPeer.PROJECT"_ID)) Criteria.LEFT_JOIN);
If a default schema name is set for the used database and leftTable or rightTable are a simple unqualified table names, the default schema name is prepended to the table name. For more complicated "table names", no schema resolution is done.- Parameter:
leftTable
- the left table of the join, or null to determine the left table from the join condition.rightTable
- the left table of the join, or null to determine the left table from the join condition.joinCondition
- the join condition, not null.joinType
- The operator used for the join. Must be one of null, Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addJoin
public Criteria addJoin(PreparedStatementPart leftTable, PreparedStatementPart rightTable, Criterion joinCondition, JoinType joinType) Adds a join to the criteria, E.g. to create the conditionPROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID=FOO.PROJECT_ID
use
criteria.addJoin( new PreparedStatementPart(ProjectPeer.TABLE_NAME), new PreparedStatementPart(FooPeer.TABLE_NAME), new Criterion(ProjectPeer.PROJECT_ID, FooPeer.PROJECT_ID, Criteria.NOT_EQUAL) Criteria.LEFT_JOIN);
. If a default schema name is set for the used database and leftTable or rightTable are a simple unqualified table names, the default schema name is prepended to the table name. For more complicated "table names", no schema resolution is done.- Parameter:
leftTable
- the left table of the join, might contain an alias name, or null to be determined from the join clause.rightTable
- the right table of the join, might contain an alias name, or null to be determined from the join clause.joinCondition
- the join condition, not null.joinType
- The operator used for the join. Must be one of null, Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getJoins
Get the List of Joins.- Gibt zurück:
- a List which contains objects of type Join, not null.
-
setAll
Adds "ALL " to the SQL statement.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
setDistinct
Adds "DISTINCT " to the SQL statement.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
setIgnoreCase
Sets whether case should be ignored in where clauses and order by whenever String columns are encountered.- Parameter:
ignoreCase
- True if case should be ignored.- Gibt zurück:
- A modified Criteria object.
-
isIgnoreCase
public boolean isIgnoreCase()Returns whether case should be ignored in where clauses and order by whenever String columns are encountered.- Gibt zurück:
- True if case is ignored.
-
setSingleRecord
Switch the check on or off that a query returns exactly one record. Set this totrue
if you want a TorqueException to be thrown if none or 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).- Parameter:
b
- set totrue
if you expect the query to select exactly one record.- Gibt zurück:
- A modified Criteria object.
-
isSingleRecord
public boolean isSingleRecord()Returns whether the check that a query returns exactly one record is active.- Gibt zurück:
- True if the check for exactly one record is active.
-
setLimit
Set a limit for the query- Parameter:
limit
- The upper limit for the number of records returned by a query.- Gibt zurück:
- A modified Criteria object.
-
getLimit
public int getLimit()Get the upper limit for the number of records returned by a query.- Gibt zurück:
- The value for limit.
-
setOffset
Set the offset.- Parameter:
offset
- how many records should be skipped at the start of the result.- Gibt zurück:
- A modified Criteria object.
-
getOffset
public long getOffset()Get how many records should be skipped at the start of the result.- Gibt zurück:
- The value for offset.
-
getFetchSize
Returns the JDBC statement fetch size to use for queries.- Gibt zurück:
- the fetch size, or null if none is set.
-
setFetchSize
Sets the JDBC statement fetch size to use for queries.- Parameter:
fetchSize
- the fetch size, or null for not set.- Gibt zurück:
- A modified Criteria object.
-
addSelectColumn
Adds a select column to the Criteria.- Parameter:
column
- The select column to add.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getSelectColumns
Return all select columns.- Gibt zurück:
- An List with the names of the select columns, not null
-
getSelectModifiers
Return all select modifiers.- Gibt zurück:
- An UniqueList with the select modifiers.
-
addGroupByColumn
Add a group by clause.- Parameter:
groupBy
- The column to group by.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
getGroupByColumns
Get all group by columns.- Gibt zurück:
- An UniqueList with the name of the groupBy clause, not null.
-
addAscendingOrderByColumn
Adds an order by clause, explicitly specifying ascending.- Parameter:
column
- The column to order by.- Gibt zurück:
- A modified Criteria object.
-
addAscendingOrderByColumn
Add an order by clause, explicitly specifying ascending.- Parameter:
column
- The column to order by.ignoreCase
- whether to ignore case on String columns.- Gibt zurück:
- A modified Criteria object.
-
addDescendingOrderByColumn
Add order by column name, explicitly specifying descending.- Parameter:
column
- The column to order by.- Gibt zurück:
- A modified Criteria object.
-
addDescendingOrderByColumn
Add order by column name, explicitly specifying descending.- Parameter:
column
- The column to order by.ignoreCase
- whether to ignore case on String columns.- Gibt zurück:
- A modified Criteria object.
-
getOrderByColumns
Get all order by columns.- Gibt zurück:
- An UniqueList with the name of the order columns, not null.
-
getFromElements
Get all elements in the from clause of the query.- Gibt zurück:
- An UniqueList with all from elements, not null. Empty if the from elements should be computed automatically.
-
addFrom
Adds a table to the from clause, not using a joinType or joinCondition.- Parameter:
tableName
- the table name- Gibt zurück:
- the modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
addFrom
Adds a new Element to the from clause.- Parameter:
fromElement
- the element to add from- Gibt zurück:
- the modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
toString
Build a string representation of the Criteria for debugging purposes. -
equals
Checks whether an object is equal to this Criteria. This is the case if the other object is also a Criteria and has the same attributes and criterions. -
hashCode
public int hashCode()Returns the hash code value for this Criteria. -
clone
Returns a shallow copy of this object. -
and
"AND"s Criterion object with the conditions in this Criteria. This is used as follows:Criteria crit = new Criteria(); Criterion c = new Criterion(XXXPeer.ID, Integer.valueOf(5), Criteria.LESS_THAN); crit.and(c);
- Parameter:
criterion
- A Criterion object.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
and
"AND"s a new condition with the conditions in this Criteria. Depending on rValue, the condition is constructed differently: Either rValue is a unary comparison operator (i.e. is a SqlEnum and getNumberOfCompareOperands() == 1) (e.g. Criteria.ISNULL), then lValue is taken as single operand of the operator ant the passed operator is used for comparison. Otherwise, an EQUAL comparison is used for comparing rValue and lValue.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object is a unary comparison operator, it is taken as comparison operator of the condition to add. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
and
"AND"s a new condition with the conditions in this Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.comparison
- the comparison, orCriteria.CUSTOM
to specify the expression manually in the rValue parameter.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andDate
Convenience method to AND a new date comparison with the conditions in this Criteria. Equal toand(column, new GregorianCalendar(year, month,date), EQUAL);
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andDate
Convenience method to AND a new date comparison with the conditions in this Criteria. Equal toand(column, new GregorianCalendar(year, month,date), comparison);
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.comparison
- The comparison operator.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andIn
Convenience method to AND a "in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andIn
Convenience method to AND a "in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andNotIn
Convenience method to AND a "not in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME NOT IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andNotIn
Convenience method to AND a "not in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME NOT IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andVerbatimSql
Ands a verbatim sql condition to this Criteria. This is used as follows:Criteria criteria = ...; criteria.andVerbatimSql("count(foo.x) = ?", new Object[] {0});
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
andVerbatimSql
public Criteria andVerbatimSql(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) ANDs a verbatim sql condition to this Criteria. This is used as follows:Criteria criteria = new Criteria(); criteria.andVerbatimSql( "count(foo.x) = ?", new Object[] {0}, FooPeer.X, null);
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.toAddToFromClause1
- a column to add to from clause, may be null.toAddToFromClause2
- a column to add to from clause, may be null.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
or
"OR"s a Criterion object with the conditions in this Criteria. This is used as follows:Criteria crit = new Criteria(); Criterion c = new Criterion(XXXPeer.ID, Integer.valueOf(5), Criteria.LESS_THAN); crit.or(c);
- Parameter:
criterion
- A Criterion object.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
or
"OR"s a new condition with the conditions in this Criteria. Depending on rValue, the condition is constructed differently: Either rValue is a unary comparison operator (i.e. is a SqlEnum and getNumberOfCompareOperands() == 1) (e.g. Criteria.ISNULL), then lValue is taken as single operand of the operator ant the passed operator is used for comparison. Otherwise, an EQUAL comparison is used for comparing rValue and lValue.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object is a unary comparison operator, it is taken as comparison operator of the condition to add. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
or
"OR"s a new condition with the conditions in this Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.comparison
- the comparison, orCriteria.CUSTOM
to specify the expression manually in the value parameter.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orDate
Convenience method to OR a new date comparison with the conditions in this Criteria. Equal toor(column, new GregorianCalendar(year, month,date), EQUAL);
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orDate
Convenience method to OR a new date comparison with the conditions in this Criteria. Equal toor(column, new GregorianCalendar(year, month,date), comparison);
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.comparison
- The comparison operator.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orIn
Convenience method to OR a "in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orIn
Convenience method to OR a "in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orNotIn
Convenience method to OR a "not in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME NOT IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orNotIn
Convenience method to OR a "not in" comparison with the conditions in this Criteria. Creates the conditionFOO.NAME NOT IN (${values})
where ${values} contains the values to compare against.
- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orVerbatimSql
ORs a verbatim sql condition to this Criteria. This is used as follows:Criteria criteria = ...; criteria.orVerbatimSql("count(foo.x) = ?", new Object[] {0});
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
orVerbatimSql
public Criteria orVerbatimSql(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) ORs a verbatim sql condition to this Criteria. This is used as follows:Criteria criteria = new Criteria(); criteria.orVerbatimSql( "count(foo.x) = ?", new Object[] {0}, FooPeer.X, null);
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.toAddToFromClause1
- a column to add to from clause, may be null.toAddToFromClause2
- a column to add to from clause, may be null.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
where
"AND"s Criterion object with the conditions in this Criteria. Equivalent to#and(Criterion)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
criterion
- A Criterion object.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
where
"AND"s a new condition with the conditions in this Criteria. Equivalent to#and(Object, Object)
but better to read if this is the first condition to be added to the Criteria. Depending on rValue, the condition is constructed differently: Either rValue is a unary comparison operator (i.e. is a SqlEnum and getNumberOfCompareOperands() == 1) (e.g. Criteria.ISNULL), then lValue is taken as single operand of the operator ant the passed operator is used for comparison. Otherwise, an EQUAL comparison is used for comparing rValue and lValue.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object is a unary comparison operator, it is taken as comparison operator of the condition to add. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.g. string object), it is interpreted as literal value.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
where
"AND"s a new condition with the conditions in this Criteria. Equivalent to#and(Column, Object, SqlEnum)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValue
- The right hand side of the comparison, may be null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.comparison
- the comparison, orCriteria.CUSTOM
to specify the expression manually in the value parameter.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereDate
Convenience method to AND a new date comparison with the conditions in this Criteria. Equivalent to#andDate(Column, int, int, int)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereDate
Convenience method to AND a new date comparison with the conditions in this Criteria. Equivalent to#andDate(Column, int, int, int, SqlEnum)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.year
- The year to compare to.month
- The month to compare to.day
- The day to compare to.comparison
- The comparison operator.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereIn
Convenience method to AND a "in" comparison with the conditions in this Criteria. Equivalent to#andIn(Column, Object[])
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereIn
Convenience method to AND a "in" comparison with the conditions in this Criteria. Equivalent to#andIn(Column, Collection)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereNotIn
Convenience method to AND a "not in" comparison with the conditions in this Criteria. Equivalent to#andNotIn(Column, Object[])
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereNotIn
Convenience method to AND a "not in" comparison with the conditions in this Criteria. Equivalent to#andNotIn(Column, Collection)
but better to read if this is the first condition to be added to the Criteria.- Parameter:
lValue
- The left hand side of the comparison, not null. If this object implements the Column interface, it is interpreted as a (pseudo)column. If this value should be a value from the database, the object must implement theorg.apache.torque.Column
interface. If this object is a Criteria, it is interpreted as a subselect. In all other cases, (e.G. string object), it is interpreted as literal value.rValues
- The values to compare against.- Gibt zurück:
- A modified Criteria object.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereVerbatimSql
Convenience method to AND a verbatim sql condition to this Criteria. Equivalent to#andNotIn(String, String[])
but better to read if this is the first condition to be added to the Criteria. This is used as follows:Criteria criteria = new Criteria(); criteria.whereVerbatimSql("count(foo.x) = ?", new Object[] {0});
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
whereVerbatimSql
public Criteria whereVerbatimSql(String sql, Object[] replacements, Column toAddToFromClause1, Column toAddToFromClause2) Convenience method to AND a verbatim sql condition to this Criteria. Equivalent to#andNotIn(String, String[], Column, Column)
but better to read if this is the first condition to be added to the Criteria. This is used as follows:Criteria criteria = new Criteria(); criteria.whereVerbatimSql( "count(foo.x) = ?", new Object[] {0}, FooPeer.X, null);
- Parameter:
sql
- the verbatim SQL to use.replacements
- the replacements for the "?" placeholders in SQL.toAddToFromClause1
- a column to add to from clause, may be null.toAddToFromClause2
- a column to add to from clause, may be null.- Gibt zurück:
- the modified Criteria.
- Löst aus:
TorqueRuntimeException
- if this operation is performed on a Criteria composed of set parts (e.g. union, intersect, except).
-
union
Creates a SQL UNION between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
unionAll
Creates a SQL UNION ALL between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
intersect
Creates a SQL INTERSECT between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
intersectAll
Creates a SQL INTERSECT ALL between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
except
Creates a SQL EXCEPT between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
exceptAll
Creates a SQL EXCEPT between this Criteria and the passed other criteria.- Parameter:
other
- the other part of the union.- Gibt zurück:
- the modified Criteria.
-
appendSetOperation
Appends a set operation (union, except, intersect) to this Criteria. If not already done, this criteria is converted to a composite criteria.- Parameter:
other
- the other criteria, not null.setOperator
- the set operator, not null.- Löst aus:
NullPointerException
- if other or setOperator are null.
-
getSetCriteriaParts
Return the parts of the criteria which compose a query using set operations (union, except, intersect).- Gibt zurück:
- the parts, not null, empty if this query does not contain set operations
-
getSetOperator
Returns the operator between the set operations.- Gibt zurück:
- the operator, or null if this is not a composite criteria.
-
isComposite
public boolean isComposite()Returns whether this Criteria is a composite criteria, i.e. is composed from more than one Criteria related by set operations (e.g. union, except, intersect)..- Gibt zurück:
- true if the criteria consists of several parts connected by set operations, false otherwise.
-
assertNoComposite
protected void assertNoComposite()Checks that this Criteria is no composite Criteria, and throws a TorqueRuntimeException otherwise.- Löst aus:
TorqueRuntimeException
- if this Criteria is a composite Criteria.
-