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
Fields Modifier and Type Field Description static int
FLUSH_FALSE
Deprecated.use theFlushModeType
enum instead.static int
FLUSH_TRUE
Deprecated.use theFlushModeType
enum instead.static int
FLUSH_WITH_CONNECTION
Deprecated.use theFlushModeType
enum instead.static java.lang.String
HINT_RESULT_COUNT
Hint key for specifying the number of rows to optimize for.static int
OP_DELETE
Deprecated.use theQueryOperationType
instead.static int
OP_SELECT
Deprecated.use theQueryOperationType
instead.static int
OP_UPDATE
Deprecated.use theQueryOperationType
instead.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description OpenJPAQuery<X>
addAggregateListener(AggregateListener listener)
Deprecated.cast toQueryImpl
instead.OpenJPAQuery<X>
addFilterListener(FilterListener listener)
Deprecated.cast toQueryImpl
instead.OpenJPAQuery<X>
closeAll()
Close all open query results.OpenJPAQuery<X>
compile()
Compile the query.java.util.Collection
getCandidateCollection()
Return the candidate collection, ornull
if an extent was specified instead of a collection.java.lang.String[]
getDataStoreActions(java.util.Map params)
Returns a description of the commands that will be sent to the datastore in order to execute this query.OpenJPAEntityManager
getEntityManager()
The owning entity manager.FetchPlan
getFetchPlan()
Fetch plan for controlling the loading of results.int
getFirstResult()
Return the 0-based start index for the returned results.jakarta.persistence.FlushModeType
getFlushMode()
Return the current flush mode.boolean
getIgnoreChanges()
Whether to ignore changes in the current transaction.java.lang.String
getLanguage()
Query language.int
getMaxResults()
Return the maximum number of results to retrieve.java.util.Map<java.lang.String,java.lang.Object>
getNamedParameters()
The named parameters for the query; empty map if none or if query uses positional parameters.QueryOperationType
getOperation()
Query operation type.java.lang.Object[]
getPositionalParameters()
The positional parameters for the query; empty array if none or if query uses named parameters.java.lang.String
getQueryString()
Query string.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.java.lang.Class
getResultClass()
Query result element type.java.util.Set<java.lang.String>
getSupportedHints()
Gets hints supported by this query.boolean
hasPositionalParameters()
Whether this query has positional parameters.boolean
hasSubclasses()
Whether subclasses are included in the query results.OpenJPAQuery<X>
removeAggregateListener(AggregateListener listener)
Deprecated.cast toQueryImpl
instead.OpenJPAQuery<X>
removeFilterListener(FilterListener listener)
Deprecated.cast toQueryImpl
instead.OpenJPAQuery<X>
setCandidateCollection(java.util.Collection coll)
Set a collection of candidates.OpenJPAQuery<X>
setFirstResult(int startPosition)
OpenJPAQuery<X>
setFlushMode(jakarta.persistence.FlushModeType flushMode)
OpenJPAQuery<X>
setHint(java.lang.String hintName, java.lang.Object value)
OpenJPAQuery<X>
setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction.OpenJPAQuery<X>
setMaxResults(int maxResult)
OpenJPAQuery<X>
setParameter(int position, java.lang.Object value)
OpenJPAQuery<X>
setParameter(int position, java.util.Calendar value, jakarta.persistence.TemporalType temporalType)
OpenJPAQuery<X>
setParameter(int position, java.util.Date value, jakarta.persistence.TemporalType temporalType)
OpenJPAQuery<X>
setParameter(java.lang.String name, java.lang.Object value)
OpenJPAQuery<X>
setParameter(java.lang.String name, java.util.Calendar value, jakarta.persistence.TemporalType temporalType)
OpenJPAQuery<X>
setParameter(java.lang.String name, java.util.Date value, jakarta.persistence.TemporalType temporalType)
OpenJPAQuery<X>
setParameters(java.lang.Object... params)
Set parameters.OpenJPAQuery<X>
setParameters(java.util.Map params)
Set parameters.void
setRelaxBindParameterTypeChecking(java.lang.Object hint)
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.OpenJPAQuery<X>
setResultClass(java.lang.Class type)
Query result element type.OpenJPAQuery<X>
setSubclasses(boolean subs)
Whether subclasses are included in the query results.
-
-
-
Field Detail
-
HINT_RESULT_COUNT
static final java.lang.String HINT_RESULT_COUNT
Hint key for specifying the number of rows to optimize for.- See Also:
- Constant Field Values
-
OP_SELECT
@Deprecated static final int OP_SELECT
Deprecated.use theQueryOperationType
instead.- See Also:
- Constant Field Values
-
OP_DELETE
@Deprecated static final int OP_DELETE
Deprecated.use theQueryOperationType
instead.- See Also:
- Constant Field Values
-
OP_UPDATE
@Deprecated static final int OP_UPDATE
Deprecated.use theQueryOperationType
instead.- See Also:
- Constant Field Values
-
FLUSH_TRUE
@Deprecated static final int FLUSH_TRUE
Deprecated.use theFlushModeType
enum instead.- See Also:
- Constant Field Values
-
FLUSH_FALSE
@Deprecated static final int FLUSH_FALSE
Deprecated.use theFlushModeType
enum instead.- See Also:
- Constant Field Values
-
FLUSH_WITH_CONNECTION
@Deprecated static final int FLUSH_WITH_CONNECTION
Deprecated.use theFlushModeType
enum instead.- See Also:
- Constant Field Values
-
-
Method Detail
-
getEntityManager
OpenJPAEntityManager getEntityManager()
The owning entity manager.
-
getLanguage
java.lang.String getLanguage()
Query language.
-
getOperation
QueryOperationType getOperation()
Query operation type.
-
getFetchPlan
FetchPlan getFetchPlan()
Fetch plan for controlling the loading of results.
-
getQueryString
java.lang.String getQueryString()
Query string.
-
getIgnoreChanges
boolean getIgnoreChanges()
Whether to ignore changes in the current transaction.
-
setIgnoreChanges
OpenJPAQuery<X> setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction.
-
getCandidateCollection
java.util.Collection getCandidateCollection()
Return the candidate collection, ornull
if an extent was specified instead of a collection.
-
setCandidateCollection
OpenJPAQuery<X> setCandidateCollection(java.util.Collection coll)
Set a collection of candidates.
-
getResultClass
java.lang.Class getResultClass()
Query result element type.
-
setResultClass
OpenJPAQuery<X> setResultClass(java.lang.Class type)
Query result element type.
-
hasSubclasses
boolean hasSubclasses()
Whether subclasses are included in the query results.
-
setSubclasses
OpenJPAQuery<X> setSubclasses(boolean subs)
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
java.lang.Object[] getPositionalParameters()
The positional parameters for the query; empty array if none or if query uses named parameters.
-
getNamedParameters
java.util.Map<java.lang.String,java.lang.Object> getNamedParameters()
The named parameters for the query; empty map if none or if query uses positional parameters.
-
setParameters
OpenJPAQuery<X> setParameters(java.util.Map params)
Set parameters.
-
setParameters
OpenJPAQuery<X> setParameters(java.lang.Object... params)
Set parameters.
-
closeAll
OpenJPAQuery<X> closeAll()
Close all open query results.
-
getDataStoreActions
java.lang.String[] getDataStoreActions(java.util.Map params)
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
OpenJPAQuery<X> setMaxResults(int maxResult)
- Specified by:
setMaxResults
in interfacejakarta.persistence.Query
- Specified by:
setMaxResults
in interfacejakarta.persistence.TypedQuery<X>
-
setFirstResult
OpenJPAQuery<X> setFirstResult(int startPosition)
- Specified by:
setFirstResult
in interfacejakarta.persistence.Query
- Specified by:
setFirstResult
in interfacejakarta.persistence.TypedQuery<X>
-
setHint
OpenJPAQuery<X> setHint(java.lang.String hintName, java.lang.Object value)
- Specified by:
setHint
in interfacejakarta.persistence.Query
- Specified by:
setHint
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(java.lang.String name, java.lang.Object value)
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(java.lang.String name, java.util.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(java.lang.String name, java.util.Calendar 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, java.lang.Object value)
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setParameter
OpenJPAQuery<X> setParameter(int position, java.util.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, java.util.Calendar value, jakarta.persistence.TemporalType temporalType)
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.TypedQuery<X>
-
setRelaxBindParameterTypeChecking
void setRelaxBindParameterTypeChecking(java.lang.Object hint)
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:
Filters.canConvert(Class, Class, boolean)
,Filters.convert(Object, Class, boolean)
-
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
OpenJPAQuery<X> setFlushMode(jakarta.persistence.FlushModeType flushMode)
- 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 OpenJPAQuery<X> addFilterListener(FilterListener listener)
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast.
-
removeFilterListener
@Deprecated OpenJPAQuery<X> removeFilterListener(FilterListener listener)
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast.
-
addAggregateListener
@Deprecated OpenJPAQuery<X> addAggregateListener(AggregateListener listener)
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast.
-
removeAggregateListener
@Deprecated OpenJPAQuery<X> removeAggregateListener(AggregateListener listener)
Deprecated.cast toQueryImpl
instead. This method pierces the published-API boundary, as does the SPI cast.
-
getSupportedHints
java.util.Set<java.lang.String> getSupportedHints()
Gets hints supported by this query.- Since:
- 2.0.0
-
-