EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.config
Class ResultType

java.lang.Object
  extended by org.eclipse.persistence.config.ResultType

public class ResultType
extends java.lang.Object

Result type hint values. The class contains all the valid values for QueryHints.RESULT_TYPE query hint. By default in JPA for non-single select queries an Array of values is returned. If getSingleResult() is called the first array is returned, for getResultList() a List of arrays is returned.

i.e. "Select e.firstName, e.lastName from Employee e" returns List

or the native query, "SELECT * FROM EMPLOYEE" returns List

The ResultType can be used to instead return a Map of values (DatabaseRecord, ReportQueryResult).

It can also be used to return a single column, or single value. JPA Query Hint Usage:

query.setHint(QueryHints.RESULT_TYPE, ResultType.Map);

or

@QueryHint(name=QueryHints.RESULT_TYPE, value=ResultType.Map)

Hint values are case-insensitive. "" could be used instead of default value ResultType.Array.

See Also:
QueryHints.RESULT_TYPE, Record, DatabaseRecord, ReportQueryResult, ReportQuery.setReturnType(int), org.eclipse.persistence.queries.DataReadQuery#setUseAbstractRecord(boolean)
Author:
James Sutherland

Field Summary
static java.lang.String Array
          An Object array of values is returned (List or Object[]).
static java.lang.String Attribute
          A List of the first selected value is returned.
static java.lang.String DEFAULT
          The default type is Array.
static java.lang.String Map
          A Map of key value pairs is returned.
static java.lang.String Value
          The first value of the first rows is returned.
 
Constructor Summary
ResultType()
           
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Array

public static final java.lang.String Array
An Object array of values is returned (List or Object[]).

See Also:
Constant Field Values

Map

public static final java.lang.String Map
A Map of key value pairs is returned. For a native queries the keys are the column names, (List, or DatabaseRecord). For JPQL queries the keys are the attribute names, (List, or ReportQueryResult).

See Also:
Constant Field Values

Attribute

public static final java.lang.String Attribute
A List of the first selected value is returned.

See Also:
Constant Field Values

Value

public static final java.lang.String Value
The first value of the first rows is returned.

See Also:
Constant Field Values

DEFAULT

public static final java.lang.String DEFAULT
The default type is Array.

See Also:
Constant Field Values
Constructor Detail

ResultType

public ResultType()

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference