429 words
multiselect(selections) - JPA CriteriaQuery's method
Methodjavax.persistence.criteria.CriteriaQuery
CriteriaQuery<T> multiselect(
Selection... selections
)
Specify the selection items that are to be returned in the
query result.
Replaces the previously specified selection(s), if any.
The type of the result of the query execution depends on
the specification of the type of the criteria query object
created as well as the arguments to the multiselect method.
An argument to the multiselect method must not be a tuple- or array-valued compound selection item.
The semantics of this method are as follows:
-
If the type of the criteria query is
CriteriaQuery(i.e., a criteria query object created by either thecreateTupleQuerymethod or by passing aTupleclass argument to thecreateQuerymethod), aTupleobject corresponding to the arguments of themultiselectmethod, in the specified order, will be instantiated and returned for each row that results from the query execution. - If the type of the criteria query is
CriteriaQueryfor some user-defined class X (i.e., a criteria query object created by passing a X class argument to thecreateQuerymethod), the arguments to themultiselectmethod will be passed to the X constructor and an instance of type X will be returned for each row. - If the type of the criteria query is
CriteriaQueryfor some class X, an instance of type X[] will be returned for each row. The elements of the array will correspond to the arguments of themultiselectmethod, in the specified order. - If the type of the criteria query is
CriteriaQueryor if the criteria query was created without specifying a type, and only a single argument is passed to themultiselectmethod, an instance of typeObjectwill be returned for each row. - If the type of the criteria query is
CriteriaQueryor if the criteria query was created without specifying a type, and more than one argument is passed to themultiselectmethod, an instance of typeObject[]will be instantiated and returned for each row. The elements of the array will correspond to the arguments to themultiselectmethod, in the specified order.
- Parameters:
selections- selection items corresponding to the results to be returned by the query
- Returns:
- the modified query
- Throws:
IllegalArgumentException- if a selection item is not valid or if more than one selection item has the same assigned alias
- Since:
- JPA 2.0
This documentation page is derived (with some adjustments) from the open source JPA 2 RI (EclipseLink)
and is available under the terms of the Eclipse Public License, v. 1.0 and Eclipse Distribution License, v. 1.0.
and is available under the terms of the Eclipse Public License, v. 1.0 and Eclipse Distribution License, v. 1.0.
Object Relational Mapping (ORM) JPA 2 providers include Hibernate, EclipseLink, TopLink, OpenJPA and DataNucleus.
Object DB is not an ORM JPA implementation but an Object Database for Java with built in JPA 2 support.