Package org.apache.openjpa.persistence
Interface OpenJPAQuery<X>
- All Superinterfaces:
jakarta.persistence.Query
,jakarta.persistence.TypedQuery<X>
- All Known Subinterfaces:
OpenJPAQuerySPI<X>
- All Known Implementing Classes:
AbstractQuery
,QueryImpl
public interface OpenJPAQuery<X>
extends jakarta.persistence.TypedQuery<X>
Interface implemented by OpenJPA queries.
- Since:
- 0.4.0
- Author:
- Abe White
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Deprecated.static final int
Deprecated.use theFlushModeType
enum instead.static final int
Deprecated.use theFlushModeType
enum instead.static final String
Hint key for specifying the number of rows to optimize for.static final int
Deprecated.use theQueryOperationType
instead.static final int
Deprecated.use theQueryOperationType
instead.static final int
Deprecated.use theQueryOperationType
instead. -
Method Summary
Modifier and TypeMethodDescriptionaddAggregateListener
(AggregateListener listener) Deprecated.cast toQueryImpl
instead.addFilterListener
(FilterListener listener) Deprecated.cast toQueryImpl
instead.closeAll()
Close all open query results.compile()
Compile the query.Return the candidate collection, ornull
if an extent was specified instead of a collection.String[]
getDataStoreActions
(Map params) Returns a description of the commands that will be sent to the datastore in order to execute this query.The owning entity manager.Fetch plan for controlling the loading of results.int
Return the 0-based start index for the returned results.jakarta.persistence.FlushModeType
Return the current flush mode.boolean
Whether to ignore changes in the current transaction.Query language.int
Return the maximum number of results to retrieve.The named parameters for the query; empty map if none or if query uses positional parameters.Query operation type.Object[]
The positional parameters for the query; empty array if none or if query uses named parameters.Query string.boolean
Gets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint.Query result element type.Gets hints supported by this query.boolean
Whether this query has positional parameters.boolean
Whether subclasses are included in the query results.removeAggregateListener
(AggregateListener listener) Deprecated.cast toQueryImpl
instead.removeFilterListener
(FilterListener listener) Deprecated.cast toQueryImpl
instead.Set a collection of candidates.setFirstResult
(int startPosition) setFlushMode
(jakarta.persistence.FlushModeType flushMode) setIgnoreChanges
(boolean ignore) Whether to ignore changes in the current transaction.setMaxResults
(int maxResult) setParameter
(int position, Object value) setParameter
(int position, Calendar value, jakarta.persistence.TemporalType temporalType) setParameter
(int position, Date value, jakarta.persistence.TemporalType temporalType) setParameter
(String name, Object value) setParameter
(String name, Calendar value, jakarta.persistence.TemporalType temporalType) setParameter
(String name, Date value, jakarta.persistence.TemporalType temporalType) setParameters
(Object... params) Set parameters.setParameters
(Map params) Set parameters.void
Sets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint.setResultClass
(Class type) Query result element type.setSubclasses
(boolean subs) Whether subclasses are included in the query results.Methods inherited from interface jakarta.persistence.Query
executeUpdate, getHints, getLockMode, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
Methods inherited from interface jakarta.persistence.TypedQuery
getResultList, getResultStream, getSingleResult, setLockMode, setParameter, setParameter, setParameter
-
Field Details
-
HINT_RESULT_COUNT
Hint key for specifying the number of rows to optimize for.- See Also:
-
OP_SELECT
Deprecated.use theQueryOperationType
instead.- See Also:
-
OP_DELETE
Deprecated.use theQueryOperationType
instead.- See Also:
-
OP_UPDATE
Deprecated.use theQueryOperationType
instead.- See Also:
-
FLUSH_TRUE
Deprecated.use theFlushModeType
enum instead.- See Also:
-
FLUSH_FALSE
Deprecated.use theFlushModeType
enum instead.- See Also:
-
FLUSH_WITH_CONNECTION
Deprecated.use theFlushModeType
enum instead.- See Also:
-
-
Method Details
-
getEntityManager
OpenJPAEntityManager getEntityManager()The owning entity manager. -
getLanguage
String getLanguage()Query language. -
getOperation
QueryOperationType getOperation()Query operation type. -
getFetchPlan
FetchPlan getFetchPlan()Fetch plan for controlling the loading of results. -
getQueryString
String getQueryString()Query string. -
getIgnoreChanges
boolean getIgnoreChanges()Whether to ignore changes in the current transaction. -
setIgnoreChanges
Whether to ignore changes in the current transaction. -
getCandidateCollection
Collection getCandidateCollection()Return the candidate collection, ornull
if an extent was specified instead of a collection. -
setCandidateCollection
Set a collection of candidates. -
getResultClass
Class getResultClass()Query result element type. -
setResultClass
Query result element type. -
hasSubclasses
boolean hasSubclasses()Whether subclasses are included in the query results. -
setSubclasses
Whether subclasses are included in the query results. -
getFirstResult
int getFirstResult()Return the 0-based start index for the returned results.- Specified by:
getFirstResult
in interfacejakarta.persistence.Query
-
getMaxResults
int getMaxResults()Return the maximum number of results to retrieve. orInteger.MAX_VALUE
for no limit.- Specified by:
getMaxResults
in interfacejakarta.persistence.Query
-
compile
OpenJPAQuery<X> compile()Compile the query. -
hasPositionalParameters
boolean hasPositionalParameters()Whether this query has positional parameters. -
getPositionalParameters
Object[] getPositionalParameters()The positional parameters for the query; empty array if none or if query uses named parameters. -
getNamedParameters
The named parameters for the query; empty map if none or if query uses positional parameters. -
setParameters
Set parameters. -
setParameters
Set parameters. -
closeAll
OpenJPAQuery<X> closeAll()Close all open query results. -
getDataStoreActions
Returns a description of the commands that will be sent to the datastore in order to execute this query. This will typically be in the native query language of the database (e.g., SQL).- Parameters:
params
- the named parameter map for the query invocation
-
setMaxResults
- Specified by:
setMaxResults
in interfacejakarta.persistence.Query
- Specified by:
setMaxResults
in interfacejakarta.persistence.TypedQuery<X>
-
setFirstResult
- Specified by:
setFirstResult
in interfacejakarta.persistence.Query
- Specified by:
setFirstResult
in interfacejakarta.persistence.TypedQuery<X>
-
setHint
- Specified by:
setHint
in interfacejakarta.persistence.Query
- Specified by:
setHint
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(String name, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(String name, Calendar value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(int position, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(int position, Calendar value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setRelaxBindParameterTypeChecking
Sets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint.
The same can be set viahint
without puncturing standard JPA API.- Parameters:
hint
- a String or Boolean value.- See Also:
-
getRelaxBindParameterTypeChecking
boolean getRelaxBindParameterTypeChecking()Gets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint.- Returns:
- the booelan state. False by default, i.e. the type of a bind parameter value is checked strongly against the target property type.
-
setFlushMode
- Specified by:
setFlushMode
in interfacejakarta.persistence.Query
- Specified by:
setFlushMode
in interfacejakarta.persistence.TypedQuery<X>
-
getFlushMode
jakarta.persistence.FlushModeType getFlushMode()Return the current flush mode.- Specified by:
getFlushMode
in interfacejakarta.persistence.Query
-
addFilterListener
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast. -
removeFilterListener
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast. -
addAggregateListener
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast. -
removeAggregateListener
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast. -
getSupportedHints
Gets hints supported by this query.- Since:
- 2.0.0
-
FlushModeType
enum instead.