Skip Headers

# Handling Exceptions Resulting From In-Memory Queries

Previous

Next

In-memory queries may fail for several reasons, the most common of which are the following:

- The query expression is too complex to execute in memory.

- There are untriggered value holders in which indirection is used. All object models that use indirection must first trigger value holders before they conform on the relevant objects.

TopLink provides a mechanism to handle indirection exceptions. To specify how the application must handle these exceptions, use the following `InMemoryQueryIndirectionPolicy` methods:

- `throwIndirectionException`: The default setting; it is the only setting that throws indirection exceptions.

- `triggerIndirection`: Triggers all valueholders to eliminate the problem.

- `ignoreIndirectionExceptionReturnConformed`: Returns conforming if an untriggered value holder is encountered. That is, results from the database are expected to conform, and an untriggered value holder is taken to mean that the underlying attribute has not changed.

- `ignoreIndirectionExceptionReturnNotConformed`: Returns not conforming if an untriggered value holder is encountered.

  Note: When you build new applications, consider throwing all conform exceptions. This provides more detailed feedback for unsuccessful in-memory queries. For more information, see "Exceptions During Conforming".