Class DbSqlSession

java.lang.Object
org.activiti.engine.impl.db.DbSqlSession
All Implemented Interfaces:
Session
Direct Known Subclasses:
ProfilingDbSqlSession

public class DbSqlSession extends Object implements Session
  • Field Details

  • Constructor Details

  • Method Details

    • insert

      public void insert(Entity entity)
    • update

      public void update(Entity entity)
    • update

      public int update(String statement, Object parameters)
    • delete

      public void delete(String statement, Object parameter, Class<? extends Entity> entityClass)
      Executes a BulkDeleteOperation, with the sql in the statement parameter. The passed class determines when this operation will be executed: it will be executed when the particular class has passed in the EntityDependencyOrder.
    • delete

      public void delete(Entity entity)
    • selectList

      public List selectList(String statement)
    • selectList

      public List selectList(String statement, Object parameter)
    • selectList

      public List selectList(String statement, Object parameter, boolean useCache)
    • selectList

      public List selectList(String statement, Object parameter, Page page)
    • selectList

      public List selectList(String statement, Object parameter, Page page, boolean useCache)
    • selectList

      public List selectList(String statement, ListQueryParameterObject parameter, Page page)
    • selectList

      public List selectList(String statement, ListQueryParameterObject parameter, Page page, boolean useCache)
    • selectList

      public List selectList(String statement, Object parameter, int firstResult, int maxResults)
    • selectList

      public List selectList(String statement, Object parameter, int firstResult, int maxResults, boolean useCache)
    • selectList

      public List selectList(String statement, ListQueryParameterObject parameter)
    • selectList

      public List selectList(String statement, ListQueryParameterObject parameter, boolean useCache)
    • selectListWithRawParameter

      public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults)
    • selectListWithRawParameter

      public List selectListWithRawParameter(String statement, Object parameter, int firstResult, int maxResults, boolean useCache)
    • selectListWithRawParameterWithoutFilter

      public List selectListWithRawParameterWithoutFilter(String statement, Object parameter, int firstResult, int maxResults)
    • selectOne

      public Object selectOne(String statement, Object parameter)
    • selectById

      public <T extends Entity> T selectById(Class<T> entityClass, String id)
    • selectById

      public <T extends Entity> T selectById(Class<T> entityClass, String id, boolean useCache)
    • cacheLoadOrStore

      protected List cacheLoadOrStore(List<Object> loadedObjects)
    • cacheLoadOrStore

      protected Entity cacheLoadOrStore(Entity entity)
      Returns the object in the cache. If this object was loaded before, then the original object is returned (the cached version is more recent). If this is the first time this object is loaded, then the loadedObject is added to the cache.
    • flush

      public void flush()
      Specified by:
      flush in interface Session
    • removeUnnecessaryOperations

      protected void removeUnnecessaryOperations()
      Clears all deleted and inserted objects from the cache, and removes inserts and deletes that cancel each other.

      Also removes deletes with duplicate ids.

    • determineUpdatedObjects

      public void determineUpdatedObjects()
    • debugFlush

      protected void debugFlush()
    • isEntityInserted

      public boolean isEntityInserted(Entity entity)
    • isEntityToBeDeleted

      public boolean isEntityToBeDeleted(Entity entity)
    • flushInserts

      protected void flushInserts()
    • flushInsertEntities

      protected void flushInsertEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToInsert)
    • orderExecutionEntities

      protected Collection<Entity> orderExecutionEntities(Map<String,Entity> executionEntities, boolean parentBeforeChildExecution)
    • collectChildExecutionsForInsertion

      protected void collectChildExecutionsForInsertion(List<Entity> result, Map<String,List<ExecutionEntity>> parentToChildrenMapping, Set<String> handledExecutionIds, String parentId, boolean parentBeforeChildExecution)
    • flushRegularInsert

      protected void flushRegularInsert(Entity entity, Class<? extends Entity> clazz)
    • flushBulkInsert

      protected void flushBulkInsert(Collection<Entity> entities, Class<? extends Entity> clazz)
    • incrementRevision

      protected void incrementRevision(Entity insertedObject)
    • flushUpdates

      protected void flushUpdates()
    • flushDeletes

      protected void flushDeletes()
    • flushBulkDeletes

      protected void flushBulkDeletes(Class<? extends Entity> entityClass)
    • flushDeleteEntities

      protected void flushDeleteEntities(Class<? extends Entity> entityClass, Collection<Entity> entitiesToDelete)
    • close

      public void close()
      Specified by:
      close in interface Session
    • commit

      public void commit()
    • rollback

      public void rollback()
    • dbSchemaCheckVersion

      public void dbSchemaCheckVersion()
    • addMissingComponent

      protected String addMissingComponent(String missingComponents, String component)
    • getDbVersion

      protected String getDbVersion()
    • dbSchemaCreate

      public void dbSchemaCreate()
    • dbSchemaCreateHistory

      protected void dbSchemaCreateHistory()
    • dbSchemaCreateEngine

      protected void dbSchemaCreateEngine()
    • dbSchemaDrop

      public void dbSchemaDrop()
    • dbSchemaPrune

      public void dbSchemaPrune()
    • executeMandatorySchemaResource

      public void executeMandatorySchemaResource(String operation, String component)
    • dbSchemaUpdate

      public String dbSchemaUpdate()
    • findMatchingVersionIndex

      protected int findMatchingVersionIndex(String dbVersion)
      Returns the index in the list of ACTIVITI_VERSIONS matching the provided string version. Returns -1 if no match can be found.
    • isEngineTablePresent

      public boolean isEngineTablePresent()
    • isHistoryTablePresent

      public boolean isHistoryTablePresent()
    • isTablePresent

      public boolean isTablePresent(String tableName)
    • prependDatabaseTablePrefix

      protected String prependDatabaseTablePrefix(String tableName)
    • dbSchemaUpgrade

      protected void dbSchemaUpgrade(String component, int currentDatabaseVersionsIndex)
    • getResourceForDbOperation

      public String getResourceForDbOperation(String directory, String operation, String component)
    • executeSchemaResource

      public void executeSchemaResource(String operation, String component, String resourceName, boolean isOptional)
    • updateDdlForMySqlVersionLowerThan56

      protected String updateDdlForMySqlVersionLowerThan56(String ddlStatements)
      MySQL is funny when it comes to timestamps and dates.

      More specifically, for a DDL statement like 'MYCOLUMN timestamp(3)': - MySQL 5.6.4+ has support for timestamps/dates with millisecond (or smaller) precision. The DDL above works and the data in the table will have millisecond precision - MySQL < 5.5.3 allows the DDL statement, but ignores it. The DDL above works but the data won't have millisecond precision - MySQL 5.5.3 < [version] < 5.6.4 gives and exception when using the DDL above.

      Also, the 5.5 and 5.6 branches of MySQL are both actively developed and patched.

      Hence, when doing auto-upgrade/creation of the Activiti tables, the default MySQL DDL file is used and all timestamps/datetimes are converted to not use the millisecond precision by string replacement done in the method below.

      If using the DDL files directly (which is a sane choice in production env.), there is a distinction between MySQL version < 5.6.

    • addSqlStatementPiece

      protected String addSqlStatementPiece(String sqlStatement, String line)
    • readNextTrimmedLine

      protected String readNextTrimmedLine(BufferedReader reader) throws IOException
      Throws:
      IOException
    • isMissingTablesException

      protected boolean isMissingTablesException(Exception e)
    • performSchemaOperationsProcessEngineBuild

      public void performSchemaOperationsProcessEngineBuild()
    • performSchemaOperationsProcessEngineClose

      public void performSchemaOperationsProcessEngineClose()
    • getCustomMapper

      public <T> T getCustomMapper(Class<T> type)
    • isMysql

      public boolean isMysql()
    • isMariaDb

      public boolean isMariaDb()
    • isOracle

      public boolean isOracle()
    • createDeploymentQuery

      public DeploymentQueryImpl createDeploymentQuery()
    • createModelQueryImpl

      public ModelQueryImpl createModelQueryImpl()
    • createProcessDefinitionQuery

      public ProcessDefinitionQueryImpl createProcessDefinitionQuery()
    • createProcessInstanceQuery

      public ProcessInstanceQueryImpl createProcessInstanceQuery()
    • createExecutionQuery

      public ExecutionQueryImpl createExecutionQuery()
    • createTaskQuery

      public TaskQueryImpl createTaskQuery()
    • createJobQuery

      public JobQueryImpl createJobQuery()
    • createHistoricProcessInstanceQuery

      public HistoricProcessInstanceQueryImpl createHistoricProcessInstanceQuery()
    • createHistoricActivityInstanceQuery

      public HistoricActivityInstanceQueryImpl createHistoricActivityInstanceQuery()
    • createHistoricTaskInstanceQuery

      public HistoricTaskInstanceQueryImpl createHistoricTaskInstanceQuery()
    • createHistoricDetailQuery

      public HistoricDetailQueryImpl createHistoricDetailQuery()
    • createHistoricVariableInstanceQuery

      public HistoricVariableInstanceQueryImpl createHistoricVariableInstanceQuery()
    • getSqlSession

      public org.apache.ibatis.session.SqlSession getSqlSession()
    • getDbSqlSessionFactory

      public DbSqlSessionFactory getDbSqlSessionFactory()