|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.stc.eindex.ejb.query.QueryObject
The QueryObject class represents the criteria and conditions of an object query in the master index. It is the primary class for interacting with the Query Manager (class QueryManager), which executes each query. QueryObject holds the query information read by the Query Manager, and is used to set select fields for an object and to set conditions on object fields. The Query Manager transforms the query object into a relational database SQL query. The generated SQL statements contain select fields and conditions as the WHERE clause of the SQL query and always include primary keys of the objects. The statements might also include an "ORDER BY primary_key" clause.
You can query from multiple objects and set conditions on any object attributes. The relationship between objects does not need to be specified by the client; they are obtained internally and mapped by the Query Manager. Use the qualified field name syntax to specify fields (see the eView Studio or eIndex Single Patient Identifier User's Guide for more information about field syntax conventions).
Constructor Summary | |
QueryObject()
Creates a new instance of the QueryObject class. |
|
QueryObject(QueryObject qo)
This a copy constructor for the QueryObject class and creates a copy of the specified query object. |
Method Summary | |
void |
addCondition(Condition condition)
Adds a condition, specified by an instance of the Condition class to the query object. |
void |
addCondition(java.lang.String field,
java.lang.String value)
This is an overload method of addCondition, differing in that the default operator is = (equal to) and the value is a string. |
void |
addCondition(java.lang.String field,
java.lang.String operator,
java.lang.Object value)
Specifies a condition for the WHERE clause of the SQL query. |
void |
addCondition(java.lang.String field,
java.lang.String operator,
java.lang.String value)
This is an overload method of addCondition, differing in that the value parameter is a String. |
void |
addSelect(java.lang.String field)
Adds a field to the SELECT portion of the SQL statement. |
(package private) int |
getResultSetType()
Return the ResultSet Type for the query object. |
void |
setAssembleDescriptor(AssembleDescriptor assDesc)
Sets the assemble descriptor (class AssembleDescriptor) for the QueryObject. |
void |
setCondition(Condition[] conditions)
Specifies all the conditions of the query. |
void |
setCondition(Condition[][] conditions)
Specifies multiple sets of conditions so the query object (more specifically the Query Manager) will logically use a UNION operator between each set of conditions in the SQL statement. |
void |
setFetchSize(int fetchSize)
Specifies the number of objects to return in each batch. |
void |
setHints(java.lang.String[][] hints)
Adds database hints to the SELECT statements of the SQL query. |
void |
setMaxObjects(int maxObjects)
Limits the maximum number of objects returned from a query. |
void |
setQueryOption(int option)
Specifies a query option that indicates to the parser whether to perform a single or multiple query. |
void |
setSelect(java.lang.String[] fields)
Specifies multiple fields for the SELECT portion of the SQL statement. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public QueryObject()
public QueryObject(QueryObject qo)
qo
- The query object to copy.
Method Detail |
public void addCondition(Condition condition)
condition
- The condition to be added to the query object.
void
- None.
public void addCondition(java.lang.String field, java.lang.String value)
field
- The fully qualified field name for the WHERE clause.value
- The value for the WHERE clause.
void
- None.
public void addCondition(java.lang.String field, java.lang.String operator, java.lang.Object value)
field
- The fully qualified field name for the WHERE clause.operator
- The SQL operator for the WHERE clause. Available operators
are = (equal to) and LIKE.value
- The value for the WHERE clause. The value can be of the
type java.sql.
void
- None.
public void addCondition(java.lang.String field, java.lang.String operator, java.lang.String value)
field
- The fully qualified field name for the WHERE clause.operator
- The SQL operator for the WHERE clause. Available operators
are = (equal to) and LIKE.value
- The value for the WHERE clause.
void
- None.
public void addSelect(java.lang.String field)
field
- The name of a field to include in the SELECT portion of t
the SQL statement.
void
- None.
int getResultSetType()
int
- Type of ResultSet
public void setAssembleDescriptor(AssembleDescriptor assDesc)
Note: This method is not required if you intend to delay the assembly of the query object. Use the QueryManager.execute() method instead.
assDesc
- The assemble descriptor to use for this query object.
void
- None.
public void setCondition(Condition[] conditions)
conditions
- An array of query conditions (including the name
operator, and value).
void
- None.
public void setCondition(Condition[][] conditions)
conditions
- An array of query condition arrays.
void
- None.
public void setFetchSize(int fetchSize)
fetchSize
- The maximum number of objects to return in each batch.
void
- None.
public void setHints(java.lang.String[][] hints)
To use this method properly, determine how many queries are generated by running in DEBUG mode first. Then you can set the SQL text appropriately. If the number of hints is less than the number of generated SELECT statements, the remaining SELECT statements are not passed any hints. If the number of hints is greater than the number of SELECT statements, the extra hints are ignored. The Query Manager automatically adds any necessary delimiters, such as "/*+" to the hint.
Oracle usage example: To pass the hint "FIRST_ROWS_100" to only the first SELECT statement, use the following: String hints[][] = {{"FIRST_ROWS_100"}}
SQL Server usage example: To pass the hint "FAST 100" to only the first SELECT statement, use the following: String hints[][] = {{"FAST 100"}}
hints
- An array of hints to add to the SELECT statements generated by
the Query Manager.
void
- None.
public void setMaxObjects(int maxObjects)
Note: Internally, the Query Manager may convert maxObjects to "rownum < X" in the WHERE clause (where "X" is the maximum number of objects you specify). The Query Manager may retrieve more rows than specified in order to create the maximum number of objects.
maxObjects
- The maximum number of objects to be retrieved.
void
- None.
public void setQueryOption(int option)
option
- An identification code that indicates which query option
to use. 1 indicates SINGLE_QUERY; 2 indicates MULTIPLE_QUERY.
void
- None.
public void setSelect(java.lang.String[] fields)
fields
- An array of fields to be selected in the SQL query.
void
- None.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2007 by Sun Microsystems, Inc. All Rights Reserved.