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
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intDeprecated.use theFlushModeTypeenum instead.static final intDeprecated.use theFlushModeTypeenum instead.static final StringHint key for specifying the number of rows to optimize for.static final intDeprecated.use theQueryOperationTypeinstead.static final intDeprecated.use theQueryOperationTypeinstead.static final intDeprecated.use theQueryOperationTypeinstead. -
Method Summary
Modifier and TypeMethodDescriptionaddAggregateListener(AggregateListener listener) Deprecated.cast toQueryImplinstead.addFilterListener(FilterListener listener) Deprecated.cast toQueryImplinstead.closeAll()Close all open query results.compile()Compile the query.Return the candidate collection, ornullif 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.intReturn the 0-based start index for the returned results.jakarta.persistence.FlushModeTypeReturn the current flush mode.booleanWhether to ignore changes in the current transaction.Query language.intReturn 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.booleanGets 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.booleanWhether this query has positional parameters.booleanWhether subclasses are included in the query results.removeAggregateListener(AggregateListener listener) Deprecated.cast toQueryImplinstead.removeFilterListener(FilterListener listener) Deprecated.cast toQueryImplinstead.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.voidSets 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, unwrapMethods 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 theQueryOperationTypeinstead.- See Also:
-
OP_DELETE
Deprecated.use theQueryOperationTypeinstead.- See Also:
-
OP_UPDATE
Deprecated.use theQueryOperationTypeinstead.- See Also:
-
FLUSH_TRUE
Deprecated.use theFlushModeTypeenum instead.- See Also:
-
FLUSH_FALSE
Deprecated.use theFlushModeTypeenum instead.- See Also:
-
FLUSH_WITH_CONNECTION
Deprecated.use theFlushModeTypeenum 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, ornullif 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:
getFirstResultin interfacejakarta.persistence.Query
-
getMaxResults
int getMaxResults()Return the maximum number of results to retrieve. orInteger.MAX_VALUEfor no limit.- Specified by:
getMaxResultsin 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:
setMaxResultsin interfacejakarta.persistence.Query- Specified by:
setMaxResultsin interfacejakarta.persistence.TypedQuery<X>
-
setFirstResult
- Specified by:
setFirstResultin interfacejakarta.persistence.Query- Specified by:
setFirstResultin interfacejakarta.persistence.TypedQuery<X>
-
setHint
- Specified by:
setHintin interfacejakarta.persistence.Query- Specified by:
setHintin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
- Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(String name, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(String name, Calendar value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
- Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(int position, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(int position, Calendar value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameterin interfacejakarta.persistence.Query- Specified by:
setParameterin 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 viahintwithout 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:
setFlushModein interfacejakarta.persistence.Query- Specified by:
setFlushModein interfacejakarta.persistence.TypedQuery<X>
-
getFlushMode
jakarta.persistence.FlushModeType getFlushMode()Return the current flush mode.- Specified by:
getFlushModein interfacejakarta.persistence.Query
-
addFilterListener
Deprecated.cast toQueryImplinstead. This method pierces the published-API boundary, as does the SPI cast. -
removeFilterListener
Deprecated.cast toQueryImplinstead. This method pierces the published-API boundary, as does the SPI cast. -
addAggregateListener
Deprecated.cast toQueryImplinstead. This method pierces the published-API boundary, as does the SPI cast. -
removeAggregateListener
Deprecated.cast toQueryImplinstead. This method pierces the published-API boundary, as does the SPI cast. -
getSupportedHints
Gets hints supported by this query.- Since:
- 2.0.0
-
FlushModeTypeenum instead.