org.camunda.bpm.engine.impl
Class AbstractNativeQuery<T extends NativeQuery<?,?>,U>

java.lang.Object
  extended by org.camunda.bpm.engine.impl.AbstractNativeQuery<T,U>
All Implemented Interfaces:
Serializable, Command<Object>, NativeQuery<T,U>
Direct Known Subclasses:
NativeExecutionQueryImpl, NativeHistoricActivityInstanceQueryImpl, NativeHistoricCaseActivityInstanceQueryImpl, NativeHistoricCaseInstanceQueryImpl, NativeHistoricProcessInstanceQueryImpl, NativeHistoricTaskInstanceQueryImpl, NativeHistoryDecisionInstanceQueryImpl, NativeProcessInstanceQueryImpl, NativeTaskQueryImpl

public abstract class AbstractNativeQuery<T extends NativeQuery<?,?>,U>
extends Object
implements Command<Object>, NativeQuery<T,U>, Serializable

Abstract superclass for all native query types.

Author:
Bernd Ruecker (camunda)
See Also:
Serialized Form

Field Summary
protected  CommandContext commandContext
           
protected  CommandExecutor commandExecutor
           
protected  int firstResult
           
protected  int maxResults
           
protected  org.camunda.bpm.engine.impl.AbstractNativeQuery.ResultType resultType
           
 
Constructor Summary
  AbstractNativeQuery(CommandContext commandContext)
           
protected AbstractNativeQuery(CommandExecutor commandExecutor)
           
 
Method Summary
 long count()
          Executes the query and returns the number of results
 Object execute(CommandContext commandContext)
           
abstract  long executeCount(CommandContext commandContext, Map<String,Object> parameterMap)
           
abstract  List<U> executeList(CommandContext commandContext, Map<String,Object> parameterMap, int firstResult, int maxResults)
          Executes the actual query to retrieve the list of results.
 U executeSingleResult(CommandContext commandContext)
           
 Map<String,Object> getParameters()
           
 List<U> list()
          Executes the query and get a list of entities as the result.
 List<U> listPage(int firstResult, int maxResults)
          Executes the query and get a list of entities as the result.
 T parameter(String name, Object value)
          Add parameter to be replaced in query for index, e.g.
 AbstractNativeQuery<T,U> setCommandExecutor(CommandExecutor commandExecutor)
           
 U singleResult()
          Executes the query and returns the resulting entity or null if no entity matches the query criteria.
 T sql(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
 

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(String sqlStatement)
Description copied from interface: NativeQuery
Hand 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:
sql in interface NativeQuery<T extends NativeQuery<?,?>,U>

parameter

public T parameter(String name,
                   Object value)
Description copied from interface: NativeQuery
Add parameter to be replaced in query for index, e.g. :param1, :myParam, ...

Specified by:
parameter in interface NativeQuery<T extends NativeQuery<?,?>,U>

singleResult

public U singleResult()
Description copied from interface: NativeQuery
Executes the query and returns the resulting entity or null if no entity matches the query criteria.

Specified by:
singleResult in interface NativeQuery<T extends NativeQuery<?,?>,U>

list

public List<U> list()
Description copied from interface: NativeQuery
Executes the query and get a list of entities as the result.

Specified by:
list in interface NativeQuery<T extends NativeQuery<?,?>,U>

listPage

public List<U> listPage(int firstResult,
                        int maxResults)
Description copied from interface: NativeQuery
Executes the query and get a list of entities as the result.

Specified by:
listPage in interface NativeQuery<T extends NativeQuery<?,?>,U>

count

public long count()
Description copied from interface: NativeQuery
Executes the query and returns the number of results

Specified by:
count in interface NativeQuery<T extends NativeQuery<?,?>,U>

execute

public Object execute(CommandContext commandContext)
Specified by:
execute in interface Command<Object>

executeCount

public abstract long executeCount(CommandContext commandContext,
                                  Map<String,Object> parameterMap)

executeList

public abstract List<U> executeList(CommandContext commandContext,
                                    Map<String,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 Map<String,Object> getParameters()


Copyright © 2016 camunda services GmbH. All rights reserved.