public class QueryImpl
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
UNDEFINED |
Constructor and Description |
---|
QueryImpl(DatabaseQuery query,
EntityManagerImpl entityManager)
Create an EJBQueryImpl with a DatabaseQuery.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This method should be called to close any left over open connection to
the database (if there is one).
|
int |
executeUpdate()
Execute an update or delete statement.
|
DatabaseQuery |
getDatabaseQuery()
Return the wrapped
DatabaseQuery ensuring that if it
isShared it is cloned before returning to prevent corruption of
the query cache. |
DatabaseQuery |
getDatabaseQueryInternal()
INTERNAL: Return the cached database query for this EJBQueryImpl.
|
JpaEntityManager |
getEntityManager()
Return the entityManager this query is tied to.
|
int |
getFirstResult() |
javax.persistence.FlushModeType |
getFlushMode() |
java.util.Map<java.lang.String,java.lang.Object> |
getHints() |
javax.persistence.LockModeType |
getLockMode()
Get the current lock mode for the query.
|
int |
getMaxResults() |
int |
getMaxResultsInternal() |
javax.persistence.Parameter<?> |
getParameter(int position) |
<T> javax.persistence.Parameter<T> |
getParameter(int position,
java.lang.Class<T> type) |
javax.persistence.Parameter<?> |
getParameter(java.lang.String name) |
<T> javax.persistence.Parameter<T> |
getParameter(java.lang.String name,
java.lang.Class<T> type) |
static java.lang.String |
getParameterId(javax.persistence.Parameter param)
Return the identifier of this parameter.
|
java.util.Set<javax.persistence.Parameter<?>> |
getParameters() |
java.lang.Object |
getParameterValue(int position)
Return the value bound to the positional parameter.
|
<T> T |
getParameterValue(javax.persistence.Parameter<T> param) |
java.lang.Object |
getParameterValue(java.lang.String name)
Return the value bound to the named parameter.
|
java.util.List |
getResultList()
Execute the query and return the query results as a List.
|
java.lang.Object |
getSingleResult()
Execute a SELECT query that returns a single untyped result.
|
java.util.Set<java.lang.String> |
getSupportedHints() |
boolean |
isBound(javax.persistence.Parameter<?> param)
Return a boolean indicating whether a value has been bound to the
parameter.
|
void |
setDatabaseQuery(DatabaseQuery query)
Replace the cached query with the given query.
|
QueryImpl |
setFirstResult(int startPosition)
Set the position of the first result to retrieve.
|
QueryImpl |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode type to be used for the query execution.
|
QueryImpl |
setLockMode(javax.persistence.LockModeType lockMode)
Set the lock mode type to be used for the query execution.
|
QueryImpl |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
void |
setMaxResultsInternal(int maxResult)
Set the maximum number of results to retrieve.
|
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> cls)
Unwrap the query into the JPA implementation classes/interfaces or the
underlying native EclipseLink query.
|
public static final int UNDEFINED
public QueryImpl(DatabaseQuery query, EntityManagerImpl entityManager)
public void close()
public int executeUpdate()
public DatabaseQuery getDatabaseQuery()
DatabaseQuery
ensuring that if it
isShared
it is cloned before returning to prevent corruption of
the query cache.getDatabaseQueryInternal()
public DatabaseQuery getDatabaseQueryInternal()
public JpaEntityManager getEntityManager()
public javax.persistence.LockModeType getLockMode()
java.lang.IllegalStateException
- if not a Java Persistence query language SELECT querypublic java.util.List getResultList()
public java.lang.Object getSingleResult()
javax.persistence.NoResultException
- if there is no resultjavax.persistence.NonUniqueResultException
- if more than one resultjava.lang.IllegalStateException
- if called for a Java Persistence query
language UPDATE or DELETE statementQueryTimeoutException
- if the query execution exceeds the query
timeout value set and only the statement is rolled backTransactionRequiredException
- if a lock mode other than NONE has
been been set and there is no transaction or the persistence
context has not been joined to the transactionjavax.persistence.PessimisticLockException
- if pessimistic locking fails and the
transaction is rolled backjavax.persistence.LockTimeoutException
- if pessimistic locking fails and only the
statement is rolled backjavax.persistence.PersistenceException
- if the query execution exceeds the query
timeout value set and the transaction is rolled backpublic void setDatabaseQuery(DatabaseQuery query)
public QueryImpl setFirstResult(int startPosition)
start
- position of the first result, numbered from 0public int getFirstResult()
Query.getFirstResult()
public QueryImpl setFlushMode(javax.persistence.FlushModeType flushMode)
flushMode
- public static java.lang.String getParameterId(javax.persistence.Parameter param)
param
- public boolean isBound(javax.persistence.Parameter<?> param)
param
- parameter objectpublic QueryImpl setLockMode(javax.persistence.LockModeType lockMode)
lockMode
- java.lang.IllegalStateException
- if not a Java Persistence query language SELECT querypublic QueryImpl setMaxResults(int maxResult)
maxResult
- public int getMaxResults()
Query.getMaxResults()
public int getMaxResultsInternal()
Query.getMaxResults()
public void setMaxResultsInternal(int maxResult)
maxResult
- public javax.persistence.FlushModeType getFlushMode()
Query.getFlushMode()
public java.util.Map<java.lang.String,java.lang.Object> getHints()
Query.getHints()
public <T> javax.persistence.Parameter<T> getParameter(java.lang.String name, java.lang.Class<T> type)
Query.getParameter(String, Class)
public <T> javax.persistence.Parameter<T> getParameter(int position, java.lang.Class<T> type)
Query.getParameter(int, Class)
public javax.persistence.Parameter<?> getParameter(java.lang.String name)
Query.getParameter(String, Class)
public javax.persistence.Parameter<?> getParameter(int position)
Query.getParameter(int, Class)
public <T> T getParameterValue(javax.persistence.Parameter<T> param)
Query.getParameterValue(Parameter)
public java.lang.Object getParameterValue(java.lang.String name)
name
- java.lang.IllegalStateException
- if the parameter has not been been boundpublic java.lang.Object getParameterValue(int position)
position
- java.lang.IllegalStateException
- if the parameter has not been been boundpublic java.util.Set<javax.persistence.Parameter<?>> getParameters()
Query.getParameters()
public java.util.Set<java.lang.String> getSupportedHints()
Query#getSupportedHints()
public <T> T unwrap(java.lang.Class<T> cls)
Query.unwrap(Class)
public java.lang.String toString()
toString
in class java.lang.Object
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference