Module org.eclipse.persistence.jpa
Class EJBQueryImpl<X>
java.lang.Object
org.eclipse.persistence.internal.jpa.QueryImpl
org.eclipse.persistence.internal.jpa.EJBQueryImpl<X>
- All Implemented Interfaces:
Query,TypedQuery<X>,JpaQuery<X>
Concrete JPA query class. The JPA query wraps a DatabaseQuery which is
executed.
-
Field Summary
Fields inherited from class org.eclipse.persistence.internal.jpa.QueryImpl
databaseQuery, entityManager, firstResultIndex, isShared, lockMode, maxResults, parameters, parameterValues, queryName, UNDEFINED -
Constructor Summary
ConstructorsModifierConstructorDescriptionEJBQueryImpl(String jpql, EntityManagerImpl entityManager) Build an EJBQueryImpl based on the given jpql string.EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, boolean isNamedQuery) Create an EJBQueryImpl with either a query name or an jpql string.protectedEJBQueryImpl(EntityManagerImpl entityManager) Base constructor for EJBQueryImpl.EJBQueryImpl(DatabaseQuery query, EntityManagerImpl entityManager) Create an EJBQueryImpl with a DatabaseQuery. -
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseQuerybuildEJBQLDatabaseQuery(String queryName, String jpqlQuery, AbstractSession session, Enum lockMode, Map<String, Object> hints, ClassLoader classLoader) Build a DatabaseQuery from an JPQL string.static DatabaseQuerybuildEJBQLDatabaseQuery(String jpql, AbstractSession session) Build a DatabaseQuery from an jpql string.static DatabaseQuerybuildSQLDatabaseQuery(Class<?> resultClass, String sqlString, ClassLoader classLoader, AbstractSession session) Build a ReadAllQuery from a class and sql string.static DatabaseQuerybuildSQLDatabaseQuery(Class<?> resultClass, String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session) Build a ReadAllQuery for class and sql string.static DatabaseQuerybuildSQLDatabaseQuery(String sqlString, ClassLoader classLoader, AbstractSession session) Build a DataReadQuery from a sql string.static DatabaseQuerybuildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, ClassLoader classLoader, AbstractSession session) Build a ResultSetMappingQuery from a sql result set mapping name and sql string.static DatabaseQuerybuildSQLDatabaseQuery(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.static DatabaseQuerybuildSQLDatabaseQuery(String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session) Build a DataReadQuery from a sql string.Non-standard method to return results of a ReadQuery that has a containerPolicy that returns objects as a collection rather than a ListNon-standard method to return results of a ReadQuery that uses a Cursor.Execute a query that returns a single result.setFirstResult(int startPosition) Set the position of the first result to retrieve.setFlushMode(FlushModeType flushMode) Set the flush mode type to be used for the query execution.Set an implementation-specific hint.setLockMode(LockModeType lockMode) Set the lock mode type to be used for the query execution.setMaxResults(int maxResult) Set the maximum number of results to retrieve.setParameter(int position, Object value) Bind an argument to a positional parameter.setParameter(int position, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a positional parameter.setParameter(int position, Date value, TemporalType temporalType) Bind an instance of java.util.Date to a positional parameter.setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a Parameter object.setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Bind an instance of java.util.Date to a Parameter object.<T> TypedQuerysetParameter(Parameter<T> param, T value) Set the value of a Parameter object.setParameter(String name, Object value) Bind an argument to a named parameter.setParameter(String name, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a named parameter.setParameter(String name, Date value, TemporalType temporalType) Bind an instance of java.util.Date to a named parameter.toString()Methods inherited from class org.eclipse.persistence.internal.jpa.QueryImpl
applyArguments, applyHints, cloneSharedQuery, close, convertTemporalType, executeReadQuery, executeUpdate, getActiveSession, getDatabaseQuery, getDatabaseQueryInternal, getDetailedException, getEntityManager, getFirstResult, getFlushMode, getHints, getInternalParameters, getLockMode, getMaxResults, getMaxResultsInternal, getParameter, getParameter, getParameter, getParameter, getParameterId, getParameters, getParameterValue, getParameterValue, getParameterValue, getResultList, getSupportedHints, isBound, isFlushModeAUTO, isValidActualParameter, performPreQueryFlush, processParameters, propagateResultProperties, setAsDataModifyQuery, setAsSQLModifyQuery, setAsSQLReadQuery, setDatabaseQuery, setFirstResultInternal, setHintInternal, setMaxResultsInternal, setParameterInternal, setParameterInternal, setRollbackOnly, throwNonUniqueResultException, throwNoResultException, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.persistence.jpa.JpaQuery
getDatabaseQuery, getEntityManager, setDatabaseQueryMethods inherited from interface jakarta.persistence.Query
executeUpdate, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrapMethods inherited from interface jakarta.persistence.TypedQuery
getResultList, getResultStream
-
Constructor Details
-
EJBQueryImpl
Base constructor for EJBQueryImpl. Initializes basic variables. -
EJBQueryImpl
Create an EJBQueryImpl with a DatabaseQuery. -
EJBQueryImpl
Build an EJBQueryImpl based on the given jpql string. -
EJBQueryImpl
Create an EJBQueryImpl with either a query name or an jpql string.- Parameters:
isNamedQuery- determines whether to treat the queryDescription as jpql or a query name.
-
-
Method Details
-
buildEJBQLDatabaseQuery
Build a DatabaseQuery from an jpql string.- Parameters:
session- the session to get the descriptors for this query for.- Returns:
- a DatabaseQuery representing the given jpql.
-
buildEJBQLDatabaseQuery
public static DatabaseQuery buildEJBQLDatabaseQuery(String queryName, String jpqlQuery, AbstractSession session, Enum lockMode, Map<String, Object> hints, ClassLoader classLoader) Build a DatabaseQuery from an JPQL string.- Parameters:
jpqlQuery- the JPQL string.session- the session to get the descriptors for this query for.hints- a list of hints to be applied to the query.- Returns:
- a DatabaseQuery representing the given jpql.
-
buildSQLDatabaseQuery
public static DatabaseQuery buildSQLDatabaseQuery(Class<?> resultClass, String sqlString, ClassLoader classLoader, AbstractSession session) Build a ReadAllQuery from a class and sql string. -
buildSQLDatabaseQuery
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- a list of hints to be applied to the query.
-
buildSQLDatabaseQuery
public static DatabaseQuery buildSQLDatabaseQuery(String sqlString, ClassLoader classLoader, AbstractSession session) Build a DataReadQuery from a sql string. -
buildSQLDatabaseQuery
public static DatabaseQuery buildSQLDatabaseQuery(String sqlString, Map<String, Object> hints, ClassLoader classLoader, AbstractSession session) Build a DataReadQuery from a sql string. -
buildSQLDatabaseQuery
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. -
buildSQLDatabaseQuery
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- a list of hints to be applied to the query.
-
setHint
Set an implementation-specific hint. If the hint name is not recognized, it is silently ignored.- Specified by:
setHintin interfaceQuery- Specified by:
setHintin interfaceTypedQuery<X>- Returns:
- the same query instance
- Throws:
IllegalArgumentException- if the second argument is not valid for the implementation
-
setLockMode
Set the lock mode type to be used for the query execution.- Specified by:
setLockModein interfaceQuery- Specified by:
setLockModein interfaceTypedQuery<X>- Overrides:
setLockModein classQueryImpl- Throws:
IllegalStateException- if not a Java Persistence query language SELECT query
-
getResultCollection
Non-standard method to return results of a ReadQuery that has a containerPolicy that returns objects as a collection rather than a List- Specified by:
getResultCollectionin interfaceJpaQuery<X>- Returns:
- Collection of results
-
getResultCursor
Non-standard method to return results of a ReadQuery that uses a Cursor.- Specified by:
getResultCursorin interfaceJpaQuery<X>- Returns:
- Cursor on results, either a CursoredStream, or ScrollableCursor
-
getSingleResult
Execute a query that returns a single result.- Specified by:
getSingleResultin interfaceQuery- Specified by:
getSingleResultin interfaceTypedQuery<X>- Overrides:
getSingleResultin classQueryImpl- Returns:
- the result
- Throws:
EntityNotFoundException- if there is no resultNonUniqueResultException- if more than one result
-
setFirstResult
Set the position of the first result to retrieve.- Specified by:
setFirstResultin interfaceQuery- Specified by:
setFirstResultin interfaceTypedQuery<X>- Overrides:
setFirstResultin classQueryImpl- Parameters:
startPosition- position of the first result, numbered from 0- Returns:
- the same query instance
-
setFlushMode
Set the flush mode type to be used for the query execution.- Specified by:
setFlushModein interfaceQuery- Specified by:
setFlushModein interfaceTypedQuery<X>- Overrides:
setFlushModein classQueryImpl
-
setMaxResults
Set the maximum number of results to retrieve.- Specified by:
setMaxResultsin interfaceQuery- Specified by:
setMaxResultsin interfaceTypedQuery<X>- Overrides:
setMaxResultsin classQueryImpl- Returns:
- the same query instance
-
setParameter
Bind an instance of java.util.Calendar to a positional parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
-
setParameter
Bind an instance of java.util.Date to a positional parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
-
setParameter
Bind an argument to a positional parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
-
setParameter
public TypedQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a Parameter object.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
- Throws:
IllegalArgumentException- if position does not correspond to a parameter of the query
-
setParameter
Bind an instance of java.util.Date to a Parameter object.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Parameters:
param- object- Returns:
- the same query instance
- Throws:
IllegalArgumentException- if position does not correspond to a parameter of the query
-
setParameter
Set the value of a Parameter object.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Parameters:
param- parameter to be setvalue- parameter value- Returns:
- query instance
- Throws:
IllegalArgumentException- if parameter does not correspond to a parameter of the query
-
setParameter
Bind an instance of java.util.Calendar to a named parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
-
setParameter
Bind an instance of java.util.Date to a named parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Returns:
- the same query instance
-
setParameter
Bind an argument to a named parameter.- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceTypedQuery<X>- Parameters:
name- the parameter name- Returns:
- the same query instance
-
toString
-