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

public class ResultType extends 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<Object[]>

or the native query, "SELECT * FROM EMPLOYEE" returns List<Object[]>

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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    An Object array of values is returned (List<Object[]> or Object[]).
    static final String
    A List of the first selected value is returned.
    static final String
    The default type is Array.
    static final String
    A Map of key value pairs is returned.
    static final String
    The first value of the first rows is returned.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    This constructor will be marked private and the class final.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • Array

      public static final String Array
      An Object array of values is returned (List<Object[]> or Object[]).
      See Also:
    • Map

      public static final String Map
      A Map of key value pairs is returned. For a native queries the keys are the column names, (List<DatabaseRecord>, or DatabaseRecord). For JPQL queries the keys are the attribute names, (List<ReportQueryResult>, or ReportQueryResult).
      See Also:
    • Attribute

      public static final String Attribute
      A List of the first selected value is returned.
      See Also:
    • Value

      public static final String Value
      The first value of the first rows is returned.
      See Also:
    • DEFAULT

      public static final String DEFAULT
      The default type is Array.
      See Also:
  • Constructor Details

    • ResultType

      @Deprecated(since="4.0.3", forRemoval=true) public ResultType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This constructor will be marked private and the class final. It is not designed for extensibility.