Use eclipselink.result-collection-type to configure the collection class implementation for the query's results.
Values
Table 4-38 describes this query hint's values.
Table 4-38 Valid Values for result-collection-type
| Value | Description |
|---|---|
|
|
Fully qualified class name, without |
|
|
(Default) Do not ignore |
Usage
If you use a Collection type that is not a List, you must use getResultCollection() or getSingleResult() instead of getResultList().
Examples
Example 4-77 Using result-collection-type in a JPA Query
import org.eclipse.persistence.config.HintValues;
import org.eclipse.persistence.config.QueryHints;
query.setHint("eclipselink.RESULT_COLLECTION_TYPE", "<CLASS_NAME>");
Example 4-78 Using result-collection-type in a @QueryHint Annotation
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; @QueryHint(name=QueryHints.RESULT_COLLECTION_TYPE, value="<CLASS_NAME>");
See Also
For more information, see:
"Collection Mappings" in the Understanding EclipseLink