Package org.camunda.bpm.engine.impl
Class AbstractNativeQuery<T extends NativeQuery<?,?>,U>
- java.lang.Object
-
- org.camunda.bpm.engine.impl.AbstractNativeQuery<T,U>
-
- All Implemented Interfaces:
java.io.Serializable,Command<java.lang.Object>,NativeQuery<T,U>
- Direct Known Subclasses:
NativeExecutionQueryImpl,NativeHistoricActivityInstanceQueryImpl,NativeHistoricCaseActivityInstanceQueryImpl,NativeHistoricCaseInstanceQueryImpl,NativeHistoricProcessInstanceQueryImpl,NativeHistoricTaskInstanceQueryImpl,NativeHistoricVariableInstanceQueryImpl,NativeHistoryDecisionInstanceQueryImpl,NativeProcessInstanceQueryImpl,NativeTaskQueryImpl,NativeUserQueryImpl
public abstract class AbstractNativeQuery<T extends NativeQuery<?,?>,U> extends java.lang.Object implements Command<java.lang.Object>, NativeQuery<T,U>, java.io.Serializable
Abstract superclass for all native query types.- Author:
- Bernd Ruecker (camunda)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CommandContextcommandContextprotected CommandExecutorcommandExecutorprotected intfirstResultprotected intmaxResultsprotected org.camunda.bpm.engine.impl.AbstractNativeQuery.ResultTyperesultType
-
Constructor Summary
Constructors Modifier Constructor Description AbstractNativeQuery(CommandContext commandContext)protectedAbstractNativeQuery(CommandExecutor commandExecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longcount()Executes the query and returns the number of resultsjava.lang.Objectexecute(CommandContext commandContext)abstract longexecuteCount(CommandContext commandContext, java.util.Map<java.lang.String,java.lang.Object> parameterMap)abstract java.util.List<U>executeList(CommandContext commandContext, java.util.Map<java.lang.String,java.lang.Object> parameterMap, int firstResult, int maxResults)Executes the actual query to retrieve the list of results.UexecuteSingleResult(CommandContext commandContext)java.util.Map<java.lang.String,java.lang.Object>getParameters()java.util.List<U>list()Executes the query and get a list of entities as the result.java.util.List<U>listPage(int firstResult, int maxResults)Executes the query and get a list of entities as the result.Tparameter(java.lang.String name, java.lang.Object value)Add parameter to be replaced in query for index, e.g.AbstractNativeQuery<T,U>setCommandExecutor(CommandExecutor commandExecutor)UsingleResult()Executes the query and returns the resulting entity or null if no entity matches the query criteria.Tsql(java.lang.String sqlStatement)Hand in the SQL statement you want to execute.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.impl.interceptor.Command
isRetryable
-
-
-
-
Field Detail
-
commandExecutor
protected transient CommandExecutor commandExecutor
-
commandContext
protected transient CommandContext commandContext
-
maxResults
protected int maxResults
-
firstResult
protected int firstResult
-
resultType
protected org.camunda.bpm.engine.impl.AbstractNativeQuery.ResultType resultType
-
-
Constructor Detail
-
AbstractNativeQuery
protected AbstractNativeQuery(CommandExecutor commandExecutor)
-
AbstractNativeQuery
public AbstractNativeQuery(CommandContext commandContext)
-
-
Method Detail
-
setCommandExecutor
public AbstractNativeQuery<T,U> setCommandExecutor(CommandExecutor commandExecutor)
-
sql
public T sql(java.lang.String sqlStatement)
Description copied from interface:NativeQueryHand in the SQL statement you want to execute. BEWARE: if you need a count you have to hand in a count() statement yourself, otherwise the result will be treated as lost of Activiti entities. If you need paging you have to insert the pagination code yourself. We skipped doing this for you as this is done really different on some databases (especially MS-SQL / DB2)- Specified by:
sqlin interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
parameter
public T parameter(java.lang.String name, java.lang.Object value)
Description copied from interface:NativeQueryAdd parameter to be replaced in query for index, e.g. :param1, :myParam, ...- Specified by:
parameterin interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
singleResult
public U singleResult()
Description copied from interface:NativeQueryExecutes the query and returns the resulting entity or null if no entity matches the query criteria.- Specified by:
singleResultin interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
list
public java.util.List<U> list()
Description copied from interface:NativeQueryExecutes the query and get a list of entities as the result.- Specified by:
listin interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
listPage
public java.util.List<U> listPage(int firstResult, int maxResults)
Description copied from interface:NativeQueryExecutes the query and get a list of entities as the result.- Specified by:
listPagein interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
count
public long count()
Description copied from interface:NativeQueryExecutes the query and returns the number of results- Specified by:
countin interfaceNativeQuery<T extends NativeQuery<?,?>,U>
-
execute
public java.lang.Object execute(CommandContext commandContext)
- Specified by:
executein interfaceCommand<T extends NativeQuery<?,?>>
-
executeCount
public abstract long executeCount(CommandContext commandContext, java.util.Map<java.lang.String,java.lang.Object> parameterMap)
-
executeList
public abstract java.util.List<U> executeList(CommandContext commandContext, java.util.Map<java.lang.String,java.lang.Object> parameterMap, int firstResult, int maxResults)
Executes the actual query to retrieve the list of results.- Parameters:
maxResults-firstResult-page- used if the results must be paged. If null, no paging will be applied.
-
executeSingleResult
public U executeSingleResult(CommandContext commandContext)
-
getParameters
public java.util.Map<java.lang.String,java.lang.Object> getParameters()
-
-