Purpose: Mechanism used for all queries by example.
Responsibilities: Builds a selection criteria for this query given an example object and a QueryByExample policy. Works akin to EBQLMechanism which builds the selection criteria from an EJBQL string.
| Modifier and Type | Field and Description |
|---|---|
| protected Object | exampleObject
Used for Query By Example. |
| protected boolean | |
| protected QueryByExamplePolicy |
| Access | Constructor and Description |
|---|---|
| public | |
| public | QueryByExampleMechanism(DatabaseQuery
- owner of mechanism query, Expression - selection criteria expression)Initialize the state of the query |
| Modifier and Type | Method and Description |
|---|---|
| public void | buildSelectionCriteria(AbstractSession session)
Overrides org. |
| public Object | |
| public QueryByExamplePolicy | getQueryByExamplePolicy()
PUBLIC: When using Query By Example, an instance of QueryByExamplePolicy is used to customize the query. |
| public boolean | |
| public boolean | isQueryByExampleMechanism()
Overrides org. |
| public void | setExampleObject(Object newExampleObject)
PUBLIC: Set the example object of the query to be the newExampleObject. |
| public void | |
| public void | setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy)
PUBLIC: The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. |
| exampleObject | back to summary |
|---|---|
| protected Object exampleObject Used for Query By Example. | |
| isParsed | back to summary |
|---|---|
| protected boolean isParsed | |
| queryByExamplePolicy | back to summary |
|---|---|
| protected QueryByExamplePolicy queryByExamplePolicy | |
| QueryByExampleMechanism | back to summary |
|---|---|
| public QueryByExampleMechanism(DatabaseQuery query) Initialize the state of the query
| |
| QueryByExampleMechanism | back to summary |
|---|---|
| public QueryByExampleMechanism(DatabaseQuery query, Expression expression) Initialize the state of the query
| |
| buildSelectionCriteria | back to summary |
|---|---|
| public void buildSelectionCriteria(AbstractSession session) Overrides org. INTERNAL: In the case of EJBQL or query by example, an expression needs to be generated. Build the required expression.
| |
| getExampleObject | back to summary |
|---|---|
| public Object getExampleObject() PUBLIC: This method returns the current example object. The "example" object is an actual domain object, provided by the client, from which an expression is generated. This expression is used for a query of all objects from the same class, that match the attribute values of the "example" object. | |
| getQueryByExamplePolicy | back to summary |
|---|---|
| public QueryByExamplePolicy getQueryByExamplePolicy() PUBLIC: When using Query By Example, an instance of QueryByExamplePolicy is used to customize the query. The policy is useful when special operations are to be used for comparisons (notEqual, lessThan, greaterThan, like etc.), when a certain value is to be ignored, or when dealing with nulls. | |
| isParsed | back to summary |
|---|---|
| public boolean isParsed() INTERNAL: Is this query Parsed | |
| isQueryByExampleMechanism | back to summary |
|---|---|
| public boolean isQueryByExampleMechanism() Overrides org. Return true if this is a query by example mechanism
| |
| setExampleObject | back to summary |
|---|---|
| public void setExampleObject(Object newExampleObject) PUBLIC: Set the example object of the query to be the newExampleObject. The example object is used for Query By Example. When doing a Query By Example, an instance of the desired object is created, and the fields are filled with the values that are required in the result set. From these values the corresponding expression is build by TopLink, and the query is executed, returning the set of results. | |
| setIsParsed | back to summary |
|---|---|
| public void setIsParsed(boolean newIsParsed) INTERNAL: Set the isParsed state | |
| setQueryByExamplePolicy | back to summary |
|---|---|
| public void setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy) PUBLIC: The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. The pollicy will control what attributes should, or should not be included in the query. When dealing with nulls, using specail operations (notEqual, lessThan, like, etc.) for comparison, or chosing to include certain attributes at all times, it is useful to modify the policy accordingly. | |