Class DbSqlSession
java.lang.Object
org.camunda.bpm.engine.impl.db.AbstractPersistenceSession
org.camunda.bpm.engine.impl.db.sql.DbSqlSession
- All Implemented Interfaces:
PersistenceSession
,Session
- Direct Known Subclasses:
BatchDbSqlSession
,SimpleDbSqlSession
- Author:
- Tom Baeyens, Joram Barrez, Daniel Meyer, Sebastian Menski, Roman Smirnov
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected String
protected DbSqlSessionFactory
static final String[]
protected static final EnginePersistenceLogger
static final String[]
protected org.apache.ibatis.session.SqlSession
Fields inherited from class org.camunda.bpm.engine.impl.db.AbstractPersistenceSession
listeners
-
Constructor Summary
ConstructorDescriptionDbSqlSession
(DbSqlSessionFactory dbSqlSessionFactory) DbSqlSession
(DbSqlSessionFactory dbSqlSessionFactory, Connection connection, String catalog, String schema) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
addSqlStatementPiece
(String sqlStatement, String line) protected void
bulkDeletePerformed
(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) protected void
bulkOperationPerformed
(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) protected void
bulkUpdatePerformed
(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) void
close()
void
commit()
protected void
configureFailedDbEntityOperation
(DbEntityOperation operation, org.apache.ibatis.exceptions.PersistenceException failure) void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
protected void
entityDeletePerformed
(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) protected void
entityInsertPerformed
(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) protected void
entityUpdatePerformed
(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) protected int
executeDelete
(String deleteStatement, Object parameter) protected void
executeInsertEntity
(String insertStatement, Object parameter) void
executeMandatorySchemaResource
(String operation, String component) int
executeNonEmptyUpdateStmt
(String updateStmt, Object parameter) void
executeSchemaResource
(String schemaFileResourceName) void
executeSchemaResource
(String operation, String component, String resourceName, boolean isOptional) protected abstract void
executeSelectForUpdate
(String statement, Object parameter) executeSelectList
(String statement, Object parameter) int
executeUpdate
(String updateStatement, Object parameter) void
flush()
List<org.apache.ibatis.executor.BatchResult>
void
protected String
getResourceForDbOperation
(String directory, String operation, String component) org.apache.ibatis.session.SqlSession
protected String[]
protected void
insertEntity
(DbEntityOperation operation) boolean
boolean
protected boolean
isConcurrentModificationException
(DbOperation failedOperation, org.apache.ibatis.exceptions.PersistenceException cause) static boolean
In cases where CockroachDB is used, and a failed operation is detected, the method checks if the exception was caused by a CockroachDBTransactionRetryException
.static boolean
isCrdbConcurrencyConflictOnCommit
(Exception cause, ProcessEngineConfigurationImpl configuration) In cases where CockroachDB is used, and a failed operation is detected, the method checks if the exception was caused by a CockroachDBTransactionRetryException
.boolean
boolean
boolean
boolean
boolean
protected boolean
boolean
isTablePresent
(String tableName) void
prependDatabaseTablePrefix
(String tableName) protected String
readNextTrimmedLine
(BufferedReader reader) void
rollback()
<T extends DbEntity>
TselectById
(Class<T> type, String id) List<?>
selectList
(String statement, Object parameter) int
Methods inherited from class org.camunda.bpm.engine.impl.db.AbstractPersistenceSession
addEntityLoadListener, dbSchemaCreate, dbSchemaDrop, dbSchemaPrune, dbSchemaUpdate, deleteBulk, deleteEntity, executeDbOperation, fireEntityLoaded, updateBulk, updateEntity
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.db.PersistenceSession
executeDbOperations
-
Field Details
-
LOG
-
JDBC_METADATA_TABLE_TYPES
-
PG_JDBC_METADATA_TABLE_TYPES
-
sqlSession
protected org.apache.ibatis.session.SqlSession sqlSession -
dbSqlSessionFactory
-
connectionMetadataDefaultCatalog
-
connectionMetadataDefaultSchema
-
-
Constructor Details
-
DbSqlSession
-
DbSqlSession
public DbSqlSession(DbSqlSessionFactory dbSqlSessionFactory, Connection connection, String catalog, String schema)
-
-
Method Details
-
selectList
-
executeSelectList
-
selectById
-
selectOne
-
lock
-
executeSelectForUpdate
-
entityUpdatePerformed
protected void entityUpdatePerformed(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
bulkUpdatePerformed
protected void bulkUpdatePerformed(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
bulkDeletePerformed
protected void bulkDeletePerformed(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
bulkOperationPerformed
protected void bulkOperationPerformed(DbBulkOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
entityDeletePerformed
protected void entityDeletePerformed(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
configureFailedDbEntityOperation
protected void configureFailedDbEntityOperation(DbEntityOperation operation, org.apache.ibatis.exceptions.PersistenceException failure) -
isConcurrentModificationException
protected boolean isConcurrentModificationException(DbOperation failedOperation, org.apache.ibatis.exceptions.PersistenceException cause) -
isCrdbConcurrencyConflict
In cases where CockroachDB is used, and a failed operation is detected, the method checks if the exception was caused by a CockroachDBTransactionRetryException
.- Parameters:
cause
- for which an operation failed- Returns:
- true if the failure was due to a CRDB
TransactionRetryException
. Otherwise, it's false.
-
isCrdbConcurrencyConflictOnCommit
public static boolean isCrdbConcurrencyConflictOnCommit(Exception cause, ProcessEngineConfigurationImpl configuration) In cases where CockroachDB is used, and a failed operation is detected, the method checks if the exception was caused by a CockroachDBTransactionRetryException
. This method may be used when a CRDB Error occurs on commit, and a Command Context is not available, as it has already been closed. This is the case with Spring/JTA transaction interceptors.- Parameters:
cause
- for which an operation failedconfiguration
- of the Process Engine- Returns:
- true if the failure was due to a CRDB
TransactionRetryException
. Otherwise, it's false.
-
insertEntity
- Specified by:
insertEntity
in classAbstractPersistenceSession
-
executeInsertEntity
-
entityInsertPerformed
protected void entityInsertPerformed(DbEntityOperation operation, int rowsAffected, org.apache.ibatis.exceptions.PersistenceException failure) -
executeDelete
-
executeUpdate
-
update
-
executeNonEmptyUpdateStmt
-
flush
public void flush() -
flushOperations
public void flushOperations() -
flushBatchOperations
-
close
public void close() -
commit
public void commit() -
rollback
public void rollback() -
dbSchemaCheckVersion
public void dbSchemaCheckVersion() -
getDbVersion
- Specified by:
getDbVersion
in classAbstractPersistenceSession
-
dbSchemaCreateIdentity
protected void dbSchemaCreateIdentity()- Specified by:
dbSchemaCreateIdentity
in classAbstractPersistenceSession
-
dbSchemaCreateHistory
protected void dbSchemaCreateHistory()- Specified by:
dbSchemaCreateHistory
in classAbstractPersistenceSession
-
dbSchemaCreateEngine
protected void dbSchemaCreateEngine()- Specified by:
dbSchemaCreateEngine
in classAbstractPersistenceSession
-
dbSchemaCreateCmmn
protected void dbSchemaCreateCmmn()- Specified by:
dbSchemaCreateCmmn
in classAbstractPersistenceSession
-
dbSchemaCreateCmmnHistory
protected void dbSchemaCreateCmmnHistory()- Specified by:
dbSchemaCreateCmmnHistory
in classAbstractPersistenceSession
-
dbSchemaCreateDmn
protected void dbSchemaCreateDmn()- Specified by:
dbSchemaCreateDmn
in classAbstractPersistenceSession
-
dbSchemaCreateDmnHistory
protected void dbSchemaCreateDmnHistory()- Specified by:
dbSchemaCreateDmnHistory
in classAbstractPersistenceSession
-
dbSchemaDropIdentity
protected void dbSchemaDropIdentity()- Specified by:
dbSchemaDropIdentity
in classAbstractPersistenceSession
-
dbSchemaDropHistory
protected void dbSchemaDropHistory()- Specified by:
dbSchemaDropHistory
in classAbstractPersistenceSession
-
dbSchemaDropEngine
protected void dbSchemaDropEngine()- Specified by:
dbSchemaDropEngine
in classAbstractPersistenceSession
-
dbSchemaDropCmmn
protected void dbSchemaDropCmmn()- Specified by:
dbSchemaDropCmmn
in classAbstractPersistenceSession
-
dbSchemaDropCmmnHistory
protected void dbSchemaDropCmmnHistory()- Specified by:
dbSchemaDropCmmnHistory
in classAbstractPersistenceSession
-
dbSchemaDropDmn
protected void dbSchemaDropDmn()- Specified by:
dbSchemaDropDmn
in classAbstractPersistenceSession
-
dbSchemaDropDmnHistory
protected void dbSchemaDropDmnHistory()- Specified by:
dbSchemaDropDmnHistory
in classAbstractPersistenceSession
-
executeMandatorySchemaResource
-
isEngineTablePresent
public boolean isEngineTablePresent()- Specified by:
isEngineTablePresent
in classAbstractPersistenceSession
-
isHistoryTablePresent
public boolean isHistoryTablePresent()- Specified by:
isHistoryTablePresent
in classAbstractPersistenceSession
-
isIdentityTablePresent
public boolean isIdentityTablePresent()- Specified by:
isIdentityTablePresent
in classAbstractPersistenceSession
-
isCmmnTablePresent
public boolean isCmmnTablePresent()- Specified by:
isCmmnTablePresent
in classAbstractPersistenceSession
-
isCmmnHistoryTablePresent
public boolean isCmmnHistoryTablePresent()- Specified by:
isCmmnHistoryTablePresent
in classAbstractPersistenceSession
-
isDmnTablePresent
public boolean isDmnTablePresent()- Specified by:
isDmnTablePresent
in classAbstractPersistenceSession
-
isDmnHistoryTablePresent
public boolean isDmnHistoryTablePresent()- Specified by:
isDmnHistoryTablePresent
in classAbstractPersistenceSession
-
isTablePresent
-
getTableNamesPresent
- Specified by:
getTableNamesPresent
in interfacePersistenceSession
- Overrides:
getTableNamesPresent
in classAbstractPersistenceSession
-
getTablesPresentInOracleDatabase
- Throws:
SQLException
-
prependDatabaseTablePrefix
-
getResourceForDbOperation
-
executeSchemaResource
-
executeSchemaResource
-
addSqlStatementPiece
-
readNextTrimmedLine
- Throws:
IOException
-
isMissingTablesException
-
getTableTypes
-
getSqlSession
public org.apache.ibatis.session.SqlSession getSqlSession() -
getDbSqlSessionFactory
-