public interface RetrieveDesc extends ActionDesc
This interface represents a retrieve descriptor used by an application to retrieve container-managed entity beans from a persistent store. It allows you specify which persistent fields an application wants to retrieve. In addition, it allows an application to specify sophisticated constraints on its object retrieval.
LOG_CREATE, LOG_DESTROY, LOG_NOOP, LOG_UPDATE, OP_ABS, OP_ADD, OP_AND, OP_APPROX, OP_AVG, OP_BETWEEN, OP_CONCAT, OP_COUNT, OP_COUNT_PC, OP_DISTINCT, OP_DIV, OP_EQ, OP_EQ_CLASS, OP_EQUIJOIN, OP_EXISTS, OP_FIELD, OP_FOR_UPDATE, OP_GE, OP_GT, OP_IN, OP_LE, OP_LEFTJOIN, OP_LENGTH, OP_LENGTHB, OP_LIKE, OP_LIKE_ESCAPE, OP_LOWER, OP_LT, OP_LTRIM, OP_MAX, OP_MAX_ROWS, OP_MAYBE_NULL, OP_MIN, OP_MOD, OP_MUL, OP_NE, OP_NONKEY, OP_NONREL_JOIN, OP_NOT, OP_NOTEXISTS, OP_NOTIN, OP_NOTNULL, OP_NULL, OP_NULL_COMPARISION_FUNCTION, OP_OR, OP_ORDERBY, OP_ORDERBY_DESC, OP_PARAMETER, OP_PARAMETER_COUNT, OP_POSITION, OP_POSITION_START, OP_RIGHTJOIN, OP_RTRIM, OP_RTRIMFIXED, OP_SOUNDEX, OP_SQRT, OP_SUB, OP_SUBSTR, OP_SUBSTRB, OP_SUBSTRING, OP_SUM, OP_UPPER, OP_VALUE| Modifier and Type | Method and Description |
|---|---|
void |
addConstraint(String name,
int operation,
Object value)
Adds a constraint on the persistent field specified by
name. |
void |
addConstraint(String name,
int operator,
RetrieveDesc foreignConstraint,
String foreignFieldName)
Adds a constraint on the field specified by
name. |
void |
addConstraint(String name,
RetrieveDesc foreignConstraint)
Adds a constraint on the foreign field specified by
name. |
void |
addResult(int opCode,
int resultType)
The addResult method can be used to specify
|
void |
addResult(String name,
RetrieveDesc foreignConstraint,
boolean projection)
The addResult method is used to specify which fields should be
returned in a persistent object.
|
void |
setNavigationalId(Object navigationalId)
Sets a navigational id on the retrieve descriptor.
|
void |
setPrefetchEnabled(boolean prefetchEnabled)
Sets the prefetchEnabled option.
|
getPersistenceCapableClassvoid addResult(String name, RetrieveDesc foreignConstraint, boolean projection)
projection specifies, if the field
specified by name should be projected.name - The name of the field to return.foreignConstraint - RetrieveDesc describing fields and constraints for a referenced object.projection - Specifies, if this is a projection.void addResult(int opCode,
int resultType)
opCode - The operation code.resultType - The object type returned by aggregate queries.FieldTypeEnumerationvoid addConstraint(String name, int operation, Object value)
Adds a constraint on the persistent field specified by
name. The valid values for operation
are defined in ActionDesc. The parameter
value specifies the constraint value.
By default, multiple constraints are implicitly ANDed together. If the applications want to OR together the constraints, it can explicitly add OP_OR constraints. For example, to OR together two constraints, an application can do the following:
addConstraint("field1", ActionDesc.OP_EQ, "field1Value");
addConstraint("field2", ActionDesc.OP_EQ, "field2Value");
addConstraint(null, ActionDesc.OP_OR, null);
The important thing to note about the above example is that the constraints are processed in postfix order, so the above example should be read as
(field1 == "field1Value") OR (field2 == "field2Value")
void addConstraint(String name, RetrieveDesc foreignConstraint)
Adds a constraint on the foreign field specified by
name. This method is used to specify a relationship
navigation on field name to the class represented by
the retrieve descriptor foreignConstraint.
If name is null, an unrelated constraint is added.
A constraint is unrelated, if there is neither a foreign field
nor a local field connecting to the retrieve descriptor
foreignConstraint.
void addConstraint(String name, int operator, RetrieveDesc foreignConstraint, String foreignFieldName)
Adds a constraint on the field specified by name.
This method is useful e.g. for comparisons of local fields with field of a related object:
emp.addConstraint("lastName", ActionDesc.OP_EQ, mgr, lastName");
compares the employee's lastName field with the lastName field of the related manager.
void setNavigationalId(Object navigationalId)
void setPrefetchEnabled(boolean prefetchEnabled)
prefetchEnabled - the setting of the prefetchEnabled option.Copyright © 2017. All rights reserved.