Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa

public Class EJBQueryImpl<X>

extends QueryImpl
implements JpaQuery<X>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.JpaQuery, jakarta.persistence.TypedQuery, jakarta.persistence.Query
Imports
java.util.ArrayList, .Calendar, .Collection, .Date, .HashMap, .List, .Map, jakarta.persistence.FlushModeType, .LockModeType, .LockTimeoutException, .Parameter, .PersistenceException, .TemporalType, .TypedQuery, org.eclipse.persistence.exceptions.QueryException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform, org.eclipse.persistence.internal.helper.ClassConstants, .Helper, org.eclipse.persistence.internal.jpa.querydef.ParameterExpressionImpl, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.queries.ContainerPolicy, .JPQLCallQueryMechanism, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.jpa.JpaQuery, org.eclipse.persistence.queries.Cursor, .DataReadQuery, .DatabaseQuery, .JPAQueryBuilder, .ModifyQuery, .ObjectLevelReadQuery, .ReadAllQuery, .ReadObjectQuery, .ReadQuery, .ResultSetMappingQuery, org.eclipse.persistence.sessions.DatabaseRecord

Concrete JPA query class. The JPA query wraps a DatabaseQuery which is executed.

Field Summary

Inherited from org.eclipse.persistence.internal.jpa.QueryImpl:
databaseQueryentityManagerfirstResultIndexisSharedlockModemaxResultsparametersparameterValuesqueryNameUNDEFINED

Constructor Summary

AccessConstructor and Description
protected
EJBQueryImpl(EntityManagerImpl entityManager)

Base constructor for EJBQueryImpl.

public
EJBQueryImpl(DatabaseQuery query, EntityManagerImpl entityManager)

Create an EJBQueryImpl with a DatabaseQuery.

public
EJBQueryImpl(String jpql, EntityManagerImpl entityManager)

Build an EJBQueryImpl based on the given jpql string.

public
EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, boolean
determines whether to treat the queryDescription as jpql or a query name.
isNamedQuery
)

Create an EJBQueryImpl with either a query name or an jpql string.

Method Summary

Modifier and TypeMethod and Description
public static DatabaseQuery

Returns:

a DatabaseQuery representing the given jpql.
buildEJBQLDatabaseQuery
(String jpql, AbstractSession
the session to get the descriptors for this query for.
session
)

Build a DatabaseQuery from an jpql string.

public static DatabaseQuery

Returns:

a DatabaseQuery representing the given jpql.
buildEJBQLDatabaseQuery
(String queryName, String
the JPQL string.
jpqlQuery
,
AbstractSession
the session to get the descriptors for this query for.
session
,
Enum<E extends Enum<E>> lockMode, Map<String, Object>
a list of hints to be applied to the query.
hints
,
ClassLoader classLoader)

Build a DatabaseQuery from an JPQL string.

public static DatabaseQuery
buildSQLDatabaseQuery(Class<?> resultClass, String sqlString, ClassLoader classLoader, AbstractSession session)

Build a ReadAllQuery from a class and sql string.

public static DatabaseQuery
buildSQLDatabaseQuery(Class<?> resultClass, String sqlString, Map<String, Object>
a list of hints to be applied to the query.
hints
,
ClassLoader classLoader, AbstractSession session)

Build a ReadAllQuery for class and sql string.

public static DatabaseQuery
buildSQLDatabaseQuery(String sqlString, ClassLoader classLoader, AbstractSession session)

Build a DataReadQuery from a sql string.

public static DatabaseQuery
buildSQLDatabaseQuery(String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session)

Build a DataReadQuery from a sql string.

public static DatabaseQuery
buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, ClassLoader classLoader, AbstractSession session)

Build a ResultSetMappingQuery from a sql result set mapping name and sql string.

public static DatabaseQuery
buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, Map<String, Object>
a list of hints to be applied to the query.
hints
,
ClassLoader classLoader, AbstractSession session)

Build a ResultSetMappingQuery from a sql result set mapping name and sql string.

public Collection<E>

Returns:

Collection of results
getResultCollection
()

Implements org.eclipse.persistence.jpa.JpaQuery.getResultCollection.

Non-standard method to return results of a ReadQuery that has a containerPolicy that returns objects as a collection rather than a List
public Cursor

Returns:

Cursor on results, either a CursoredStream, or ScrollableCursor
getResultCursor
()

Implements org.eclipse.persistence.jpa.JpaQuery.getResultCursor.

Non-standard method to return results of a ReadQuery that uses a Cursor.
public X

Returns:

the result
getSingleResult
()

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult.

Implements jakarta.persistence.TypedQuery.getSingleResult.

Execute a query that returns a single result.
public EJBQueryImpl<X>

Returns:

the same query instance
setFirstResult
(int
position of the first result, numbered from 0
startPosition
)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setFirstResult.

Implements jakarta.persistence.TypedQuery.setFirstResult.

Set the position of the first result to retrieve.
public EJBQueryImpl<X>
setFlushMode(FlushModeType
flush mode
flushMode
)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setFlushMode.

Implements jakarta.persistence.TypedQuery.setFlushMode.

Set the flush mode type to be used for the query execution.
public TypedQuery<X>

Returns:

the same query instance
setHint
(String
name of property or hint
hintName
,
Object
value for the property or hint
value
)

Implements jakarta.persistence.TypedQuery.setHint.

Set an implementation-specific hint.
public EJBQueryImpl<X>
setLockMode(LockModeType
lock mode
lockMode
)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setLockMode.

Implements jakarta.persistence.TypedQuery.setLockMode.

Set the lock mode type to be used for the query execution.
public EJBQueryImpl<X>

Returns:

the same query instance
setMaxResults
(int
maximum number of results to retrieve
maxResult
)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setMaxResults.

Implements jakarta.persistence.TypedQuery.setMaxResults.

Set the maximum number of results to retrieve.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(int
position
position
,
Calendar
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a positional parameter.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(int
position
position
,
Date
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a positional parameter.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(int
position
position
,
Object
parameter value
value
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an argument to a positional parameter.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(Parameter<Calendar>
parameter object
param
,
Calendar
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a Parameter object.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(Parameter<Date>
object
param
,
Date
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a Parameter object.
public <T> TypedQuery<X>

Returns:

query instance
setParameter
(Parameter<T>
parameter to be set
param
,
T
parameter value
value
)

Implements jakarta.persistence.TypedQuery.setParameter.

Set the value of a Parameter object.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(String
parameter name
name
,
Calendar
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a named parameter.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(String
parameter name
name
,
Date
parameter value
value
,
TemporalType
temporal type
temporalType
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a named parameter.
public TypedQuery<X>

Returns:

the same query instance
setParameter
(String
the parameter name
name
,
Object
parameter value
value
)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an argument to a named parameter.
public String
toString()

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.toString.

Returns a string representation of the object.
Inherited from org.eclipse.persistence.internal.jpa.QueryImpl:
applyArgumentsapplyHintscloneSharedQuerycloseconvertTemporalTypeexecuteReadQueryexecuteUpdategetActiveSessiongetDatabaseQuerygetDatabaseQueryInternalgetDetailedExceptiongetEntityManagergetFirstResultgetFlushModegetHintsgetInternalParametersgetLockModegetMaxResultsgetMaxResultsInternalgetParametergetParametergetParametergetParametergetParameterIdgetParametersgetParameterValuegetParameterValuegetParameterValuegetResultListgetSupportedHintsisBoundisFlushModeAUTOisValidActualParameterperformPreQueryFlushprocessParameterspropagateResultPropertiessetAsDataModifyQuerysetAsSQLModifyQuerysetAsSQLReadQuerysetDatabaseQuerysetFirstResultInternalsetHintInternalsetMaxResultsInternalsetParameterInternalsetParameterInternalsetRollbackOnlythrowNonUniqueResultExceptionthrowNoResultExceptionunwrap

Constructor Detail

EJBQueryImplback to summary
protected EJBQueryImpl(EntityManagerImpl entityManager)

Base constructor for EJBQueryImpl. Initializes basic variables.

EJBQueryImplback to summary
public EJBQueryImpl(DatabaseQuery query, EntityManagerImpl entityManager)

Create an EJBQueryImpl with a DatabaseQuery.

EJBQueryImplback to summary
public EJBQueryImpl(String jpql, EntityManagerImpl entityManager)

Build an EJBQueryImpl based on the given jpql string.

EJBQueryImplback to summary
public EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, boolean isNamedQuery)

Create an EJBQueryImpl with either a query name or an jpql string.

Parameters
isNamedQuery:boolean

determines whether to treat the queryDescription as jpql or a query name.

Method Detail

buildEJBQLDatabaseQueryback to summary
public static DatabaseQuery buildEJBQLDatabaseQuery(String jpql, AbstractSession session)

Build a DatabaseQuery from an jpql string.

Parameters
session:AbstractSession

the session to get the descriptors for this query for.

Returns:DatabaseQuery

a DatabaseQuery representing the given jpql.

buildEJBQLDatabaseQueryback to summary
public static DatabaseQuery buildEJBQLDatabaseQuery(String queryName, String jpqlQuery, AbstractSession session, Enum<E extends Enum<E>> lockMode, Map<String, Object> hints, ClassLoader classLoader)

Build a DatabaseQuery from an JPQL string.

Parameters
jpqlQuery:String

the JPQL string.

session:AbstractSession

the session to get the descriptors for this query for.

hints:Map<String, Object>

a list of hints to be applied to the query.

Returns:DatabaseQuery

a DatabaseQuery representing the given jpql.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(Class<?> resultClass, String sqlString, ClassLoader classLoader, AbstractSession session)

Build a ReadAllQuery from a class and sql string.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(Class<?> resultClass, String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session)

Build a ReadAllQuery for class and sql string.

Parameters
hints:Map<String, Object>

a list of hints to be applied to the query.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(String sqlString, ClassLoader classLoader, AbstractSession session)

Build a DataReadQuery from a sql string.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session)

Build a DataReadQuery from a sql string.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, ClassLoader classLoader, AbstractSession session)

Build a ResultSetMappingQuery from a sql result set mapping name and sql string.

buildSQLDatabaseQueryback to summary
public static DatabaseQuery buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session)

Build a ResultSetMappingQuery from a sql result set mapping name and sql string.

Parameters
hints:Map<String, Object>

a list of hints to be applied to the query.

getResultCollectionback to summary
public Collection<E> getResultCollection()

Implements org.eclipse.persistence.jpa.JpaQuery.getResultCollection.

Non-standard method to return results of a ReadQuery that has a containerPolicy that returns objects as a collection rather than a List

Returns:Collection<E>

Collection of results

Annotations
@Override
getResultCursorback to summary
public Cursor getResultCursor()

Implements org.eclipse.persistence.jpa.JpaQuery.getResultCursor.

Non-standard method to return results of a ReadQuery that uses a Cursor.

Returns:Cursor

Cursor on results, either a CursoredStream, or ScrollableCursor

Annotations
@Override
getSingleResultback to summary
public X getSingleResult()

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult.

Implements jakarta.persistence.TypedQuery.getSingleResult.

Execute a query that returns a single result.

Returns:X

the result

Annotations
@Override
Exceptions
EntityNotFoundException:
if there is no result
NonUniqueResultException:
if more than one result
setFirstResultback to summary
public EJBQueryImpl<X> setFirstResult(int startPosition)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setFirstResult.

Implements jakarta.persistence.TypedQuery.setFirstResult.

Set the position of the first result to retrieve.

Parameters
startPosition:int

position of the first result, numbered from 0

Returns:EJBQueryImpl<X>

the same query instance

Annotations
@Override
setFlushModeback to summary
public EJBQueryImpl<X> setFlushMode(FlushModeType flushMode)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setFlushMode.

Implements jakarta.persistence.TypedQuery.setFlushMode.

Set the flush mode type to be used for the query execution.

Parameters
flushMode:FlushModeType

Doc from jakarta.persistence.TypedQuery.setFlushMode.

flush mode

Returns:EJBQueryImpl<X>

Doc from jakarta.persistence.TypedQuery.setFlushMode.

the same query instance

Annotations
@Override
setHintback to summary
public TypedQuery<X> setHint(String hintName, Object value)

Implements jakarta.persistence.TypedQuery.setHint.

Set an implementation-specific hint. If the hint name is not recognized, it is silently ignored.

Parameters
hintName:String

Doc from jakarta.persistence.TypedQuery.setHint.

name of property or hint

value:Object

Doc from jakarta.persistence.TypedQuery.setHint.

value for the property or hint

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
Exceptions
IllegalArgumentException:
if the second argument is not valid for the implementation
setLockModeback to summary
public EJBQueryImpl<X> setLockMode(LockModeType lockMode)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setLockMode.

Implements jakarta.persistence.TypedQuery.setLockMode.

Set the lock mode type to be used for the query execution.

Parameters
lockMode:LockModeType

Doc from jakarta.persistence.TypedQuery.setLockMode.

lock mode

Returns:EJBQueryImpl<X>

Doc from jakarta.persistence.TypedQuery.setLockMode.

the same query instance

Annotations
@Override
Exceptions
IllegalStateException:
if not a Java Persistence query language SELECT query
setMaxResultsback to summary
public EJBQueryImpl<X> setMaxResults(int maxResult)

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.setMaxResults.

Implements jakarta.persistence.TypedQuery.setMaxResults.

Set the maximum number of results to retrieve.

Parameters
maxResult:int

Doc from jakarta.persistence.TypedQuery.setMaxResults.

maximum number of results to retrieve

Returns:EJBQueryImpl<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(int position, Calendar value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a positional parameter.

Parameters
position:int

Doc from jakarta.persistence.TypedQuery.setParameter.

position

value:Calendar

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(int position, Date value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a positional parameter.

Parameters
position:int

Doc from jakarta.persistence.TypedQuery.setParameter.

position

value:Date

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(int position, Object value)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an argument to a positional parameter.

Parameters
position:int

Doc from jakarta.persistence.TypedQuery.setParameter.

position

value:Object

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a Parameter object.

Parameters
param:Parameter<Calendar>

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter object

value:Calendar

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
Exceptions
IllegalArgumentException:
if position does not correspond to a parameter of the query
setParameterback to summary
public TypedQuery<X> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a Parameter object.

Parameters
param:Parameter<Date>

object

value:Date

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
Exceptions
IllegalArgumentException:
if position does not correspond to a parameter of the query
setParameterback to summary
public <T> TypedQuery<X> setParameter(Parameter<T> param, T value)

Implements jakarta.persistence.TypedQuery.setParameter.

Set the value of a Parameter object.

Parameters
param:Parameter<T>

parameter to be set

value:T

parameter value

Returns:TypedQuery<X>

query instance

Annotations
@Override
Exceptions
IllegalArgumentException:
if parameter does not correspond to a parameter of the query
setParameterback to summary
public TypedQuery<X> setParameter(String name, Calendar value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Calendar to a named parameter.

Parameters
name:String

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter name

value:Calendar

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(String name, Date value, TemporalType temporalType)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an instance of java.util.Date to a named parameter.

Parameters
name:String

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter name

value:Date

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

temporalType:TemporalType

Doc from jakarta.persistence.TypedQuery.setParameter.

temporal type

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
setParameterback to summary
public TypedQuery<X> setParameter(String name, Object value)

Implements jakarta.persistence.TypedQuery.setParameter.

Bind an argument to a named parameter.

Parameters
name:String

the parameter name

value:Object

Doc from jakarta.persistence.TypedQuery.setParameter.

parameter value

Returns:TypedQuery<X>

the same query instance

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.eclipse.persistence.internal.jpa.QueryImpl.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override