public abstract class EJBQueryImpl extends Object
Modifier and Type | Field and Description |
---|---|
protected DatabaseQuery |
databaseQuery |
protected EntityManagerImpl |
entityManager |
protected int |
firstResultIndex |
protected int |
maxResults |
protected int |
maxRows |
protected Map |
parameters |
protected String |
queryName |
Modifier | Constructor and Description |
---|---|
|
EJBQueryImpl(DatabaseQuery query,
EntityManagerImpl entityManager)
Create an EJBQueryImpl with a TopLink query.
|
protected |
EJBQueryImpl(EntityManagerImpl entityManager)
Base constructor for EJBQueryImpl.
|
|
EJBQueryImpl(String ejbql,
EntityManagerImpl entityManager)
Build an EJBQueryImpl based on the given ejbql string
|
|
EJBQueryImpl(String queryDescription,
EntityManagerImpl entityManager,
boolean isNamedQuery)
Create an EJBQueryImpl with either a query name or an ejbql string
|
Modifier and Type | Method and Description |
---|---|
protected static void |
applyHints(HashMap hints,
DatabaseQuery query)
Set implementation-specific hints.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String ejbql,
Boolean flushOnExecute,
Session session)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String ejbql,
Boolean flushOnExecute,
Session session,
ClassLoader classLoader)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String ejbql,
Session session)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String ejbql,
Session session,
HashMap hints)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String ejbql,
Session session,
HashMap hints,
ClassLoader classLoader)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildEJBQLDatabaseQuery(String queryName,
String ejbql,
Boolean flushOnExecute,
Session session,
HashMap hints,
ClassLoader classLoader)
Build a DatabaseQuery from an EJBQL string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(Class resultClass,
String sqlString)
Build a ReadAllQuery from a class and sql string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(Class resultClass,
String sqlString,
HashMap hints)
Build a ReadAllQuery from a class and sql string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(String sqlString,
Boolean flushOnExecute)
Build a DataReadQuery from a sql string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(String sqlString,
HashMap hints)
Build a DataReadQuery from a sql string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(String sqlResultSetMappingName,
String sqlString)
Build a ResultSetMappingQuery from a sql result set mapping name and sql string.
|
static DatabaseQuery |
buildSQLDatabaseQuery(String sqlResultSetMappingName,
String sqlString,
HashMap hints)
Build a ResultSetMappingQuery from a sql result set mapping name and sql string.
|
protected Object |
executeReadQuery()
Execute a ReadQuery by assigning the stored parameter values and running it
in the database
|
int |
executeUpdate()
Execute an update or delete statement.
|
protected Session |
getActiveSession() |
DatabaseQuery |
getDatabaseQuery()
Return the cached database query for this EJBQueryImpl.
|
Collection |
getResultCollection()
Non-standard method to return results of a ReadQuery that has a containerPoliry
that returns objects as a collection rather than a List
|
List |
getResultList()
Execute the query and return the query results
as a List.
|
Object |
getSingleResult()
Execute a query that returns a single result.
|
protected boolean |
isFlushModeAUTO()
Spec.
|
protected boolean |
isValidActualParameter(Object value,
Object parameterType) |
protected void |
performPreQueryFlush() |
protected Vector |
processParameters()
Internal method to add the parameters values to the query prior to execution.
|
protected void |
propagateResultProperties() |
protected void |
setAsSQLModifyQuery()
Internal method to change the wrapped query to a DataModifyQuery if neccessary
|
protected void |
setAsSQLReadQuery()
Internal method to change the wrapped query to a DataReadQuery if neccessary
|
void |
setDatabaseQuery(DatabaseQuery query)
Replace the cached query with the given query.
|
protected void |
setFirstResultInternal(int startPosition)
Set the position of the first result to retrieve.
|
protected void |
setHintInternal(String hintName,
Object value)
Set an implementation-specific hint.
|
void |
setMaxResultsInternal(int maxResult)
Set the maximum number of results to retrieve.
|
protected void |
setParameterInternal(int position,
Object value)
Bind an argument to a positional parameter.
|
protected void |
setParameterInternal(String name,
Object value)
Bind an argument to a named parameter.
|
protected void |
setRollbackOnly() |
protected abstract void |
throwNonUniqueResultException(String message) |
protected abstract void |
throwNoResultException(String message) |
protected DatabaseQuery databaseQuery
protected EntityManagerImpl entityManager
protected String queryName
protected Map parameters
protected int firstResultIndex
protected int maxResults
protected int maxRows
protected EJBQueryImpl(EntityManagerImpl entityManager)
public EJBQueryImpl(DatabaseQuery query, EntityManagerImpl entityManager)
query
- public EJBQueryImpl(String ejbql, EntityManagerImpl entityManager)
ejbql
- entityManager
- public EJBQueryImpl(String queryDescription, EntityManagerImpl entityManager, boolean isNamedQuery)
queryDescription
- entityManager
- isNamedQuery
- determines whether to treat the query description as ejbql or a query nameprotected abstract void throwNoResultException(String message)
protected abstract void throwNonUniqueResultException(String message)
protected void setAsSQLModifyQuery()
protected void setAsSQLReadQuery()
public static DatabaseQuery buildEJBQLDatabaseQuery(String ejbql, Session session)
ejbql
- session
- the session to get the descriptors for this query for.public static DatabaseQuery buildEJBQLDatabaseQuery(String ejbql, Session session, HashMap hints)
ejbql
- session
- the session to get the descriptors for this query for.hints
- a list of hints to be applied to the querypublic static DatabaseQuery buildEJBQLDatabaseQuery(String ejbql, Session session, HashMap hints, ClassLoader classLoader)
ejbql
- session
- the session to get the descriptors for this query for.hints
- a list of hints to be applied to the queryclassLoader
- the class loader to build the query withpublic static DatabaseQuery buildEJBQLDatabaseQuery(String ejbql, Boolean flushOnExecute, Session session)
ejbql
- session
- the session to get the descriptors for this query for.public static DatabaseQuery buildEJBQLDatabaseQuery(String ejbql, Boolean flushOnExecute, Session session, ClassLoader classLoader)
ejbql
- session
- the session to get the descriptors for this query for.public static DatabaseQuery buildEJBQLDatabaseQuery(String queryName, String ejbql, Boolean flushOnExecute, Session session, HashMap hints, ClassLoader classLoader)
ejbql
- session
- the session to get the descriptors for this query for.hints
- a list of hints to be applied to the querypublic static DatabaseQuery buildSQLDatabaseQuery(Class resultClass, String sqlString)
resultClass
- flushOnExecute
- sqlString
- public static DatabaseQuery buildSQLDatabaseQuery(Class resultClass, String sqlString, HashMap hints)
resultClass
- flushOnExecute
- sqlString
- hints
- a list of hints to be applied to the querypublic static DatabaseQuery buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString)
sqlResultSetMappingName
- flushOnExecute
- sqlString
- public static DatabaseQuery buildSQLDatabaseQuery(String sqlResultSetMappingName, String sqlString, HashMap hints)
sqlResultSetMappingName
- flushOnExecute
- sqlString
- hints
- a list of hints to be applied to the querypublic static DatabaseQuery buildSQLDatabaseQuery(String sqlString, Boolean flushOnExecute)
public static DatabaseQuery buildSQLDatabaseQuery(String sqlString, HashMap hints)
protected Object executeReadQuery()
public int executeUpdate()
public DatabaseQuery getDatabaseQuery()
public Collection getResultCollection()
public List getResultList()
public Object getSingleResult()
EntityNotFoundException
- if there is no resultNonUniqueResultException
- if more than one resultprotected Vector processParameters()
public void setDatabaseQuery(DatabaseQuery query)
protected void setFirstResultInternal(int startPosition)
start
- position of the first result, numbered from 0protected static void applyHints(HashMap hints, DatabaseQuery query)
hints
- a list of hints to be applied to the queryquery
- the query to apply the hints toprotected boolean isFlushModeAUTO()
protected void setHintInternal(String hintName, Object value)
hintName
- value
- IllegalArgumentException
- if the second argument is not
valid for the implementationpublic void setMaxResultsInternal(int maxResult)
maxResult
- protected void propagateResultProperties()
protected void setParameterInternal(String name, Object value)
name
- the parameter namevalue
- protected void setParameterInternal(int position, Object value)
position
- value
- protected Session getActiveSession()
protected void performPreQueryFlush()
protected void setRollbackOnly()
Copyright © 2021. All rights reserved.