Class DbEntityManager
java.lang.Object
org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager
- All Implemented Interfaces:
EntityLoadListener
,Session
- Author:
- Daniel Meyer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
protected DbEntityCache
protected DbOperationManager
protected IdGenerator
protected boolean
protected static final EnginePersistenceLogger
protected List<OptimisticLockingListener>
protected PersistenceSession
protected static final String
-
Constructor Summary
ConstructorDescriptionDbEntityManager
(IdGenerator idGenerator, PersistenceSession persistenceSession) -
Method Summary
Modifier and TypeMethodDescriptionprotected DbEntity
cacheFilter
(DbEntity persistentObject) returns the object in the cache.protected boolean
canIgnoreHistoryModificationFailure
(DbOperation dbOperation) Determines if a failed database operation (OptimisticLockingException) on a Historic entity can be ignored.void
close()
boolean
void
void
deletePreserveOrder
(Class<? extends DbEntity> entityType, String statement, Object parameter) Several delete operations added by this method will be executed preserving the order of method calls, no matter what entity type they refer to.protected void
ensureHasId
(DbEntity dbEntity) protected List
filterLoadedObjects
(List<Object> loadedObjects) void
flush()
protected void
flushCachedEntity
(CachedDbEntity cachedDbEntity) protected void
protected void
flushDbOperations
(List<DbOperation> operationsToFlush, List<DbOperation> allOperations) void
flushEntity
(DbEntity entity) protected void
Flushes the entity cache: Depending on the entity state, the requiredDbOperation
is performed and the cache is updated.void
forceUpdate
(DbEntity entity) getCachedEntitiesByType
(Class<T> type) <T extends DbEntity>
TgetCachedEntity
(Class<T> type, String id) protected void
handleConcurrentModification
(DbOperation dbOperation) Decides if an operation that failed for concurrent modifications can be tolerated, or ifOptimisticLockingException
should be raisedprotected void
handleConcurrentModificationCrdb
(DbOperation dbOperation) protected void
protected void
protected void
void
boolean
boolean
protected boolean
isHistoricByteArray
(DbEntity dbEntity) void
void
void
void
onEntityLoaded
(DbEntity entity) protected DbBulkOperation
performBulkOperation
(Class<? extends DbEntity> entityType, String statement, Object parameter, DbOperationType operationType) protected DbBulkOperation
performBulkOperationPreserveOrder
(Class<? extends DbEntity> entityType, String statement, Object parameter, DbOperationType operationType) protected void
performEntityOperation
(CachedDbEntity cachedDbEntity, DbOperationType type) pruneDeletedEntities
(List<T> listToPrune) void
registerOptimisticLockingListener
(OptimisticLockingListener optimisticLockingListener) boolean
selectBoolean
(String statement, Object parameter) <T extends DbEntity>
TselectById
(Class<T> entityClass, String id) selectList
(String statement) selectList
(String statement, Object parameter) selectList
(String statement, Object parameter, int firstResult, int maxResults) selectList
(String statement, Object parameter, Page page) selectList
(String statement, ListQueryParameterObject parameter) selectList
(String statement, ListQueryParameterObject parameter, Page page) selectListWithRawParameter
(String statement, Object parameter, int firstResult, int maxResults) void
setDbEntityCache
(DbEntityCache dbEntityCache) void
setDbOperationManager
(DbOperationManager operationManager) void
setIgnoreForeignKeysForNextFlush
(boolean ignoreForeignKeysForNextFlush) void
undoDelete
(DbEntity entity) void
updatePreserveOrder
(Class<? extends DbEntity> entityType, String statement, Object parameter) Several update operations added by this method will be executed preserving the order of method calls, no matter what entity type they refer to.protected void
validateId
(DbEntity dbEntity)
-
Field Details
-
LOG
-
TOGGLE_FOREIGN_KEY_STMT
- See Also:
-
BATCH_SIZE
public static final int BATCH_SIZE- See Also:
-
optimisticLockingListeners
-
idGenerator
-
dbEntityCache
-
dbOperationManager
-
persistenceSession
-
isIgnoreForeignKeysForNextFlush
protected boolean isIgnoreForeignKeysForNextFlush
-
-
Constructor Details
-
DbEntityManager
-
-
Method Details
-
initializeOperationManager
protected void initializeOperationManager() -
initializeEntityCache
protected void initializeEntityCache() -
selectList
-
selectList
-
selectList
-
selectList
-
selectList
-
selectList
-
selectListWithRawParameter
-
selectOne
-
selectBoolean
-
selectById
-
getCachedEntity
-
getCachedEntitiesByType
-
filterLoadedObjects
-
cacheFilter
returns the object in the cache. if this object was loaded before, then the original object is returned. -
onEntityLoaded
- Specified by:
onEntityLoaded
in interfaceEntityLoadListener
-
lock
-
lock
-
isDirty
-
flush
public void flush() -
setIgnoreForeignKeysForNextFlush
public void setIgnoreForeignKeysForNextFlush(boolean ignoreForeignKeysForNextFlush) -
flushDbOperationManager
protected void flushDbOperationManager() -
flushDbOperations
protected void flushDbOperations(List<DbOperation> operationsToFlush, List<DbOperation> allOperations) -
flushEntity
-
handleConcurrentModification
Decides if an operation that failed for concurrent modifications can be tolerated, or ifOptimisticLockingException
should be raised- Parameters:
dbOperation
-- Throws:
OptimisticLockingException
- if there is no handler for the failure
-
handleConcurrentModificationCrdb
-
handleConcurrentModificationWithRolledBackTransaction
-
canIgnoreHistoryModificationFailure
Determines if a failed database operation (OptimisticLockingException) on a Historic entity can be ignored.- Parameters:
dbOperation
- that failed- Returns:
- true if the failure can be ignored
-
isHistoricByteArray
-
flushEntityCache
protected void flushEntityCache()Flushes the entity cache: Depending on the entity state, the requiredDbOperation
is performed and the cache is updated. -
flushCachedEntity
-
insert
-
merge
-
forceUpdate
-
delete
-
undoDelete
-
update
-
updatePreserveOrder
public DbOperation updatePreserveOrder(Class<? extends DbEntity> entityType, String statement, Object parameter) Several update operations added by this method will be executed preserving the order of method calls, no matter what entity type they refer to. They will though be executed after all "not-bulk" operations (e.g.insert(DbEntity)
ormerge(DbEntity)
) and after those updates added byupdate(Class, String, Object)
.- Parameters:
entityType
-statement
-parameter
-
-
delete
-
deletePreserveOrder
public DbBulkOperation deletePreserveOrder(Class<? extends DbEntity> entityType, String statement, Object parameter) Several delete operations added by this method will be executed preserving the order of method calls, no matter what entity type they refer to. They will though be executed after all "not-bulk" operations (e.g.insert(DbEntity)
ormerge(DbEntity)
) and after those deletes added bydelete(Class, String, Object)
.- Parameters:
entityType
-statement
-parameter
-- Returns:
- delete operation
-
performBulkOperation
protected DbBulkOperation performBulkOperation(Class<? extends DbEntity> entityType, String statement, Object parameter, DbOperationType operationType) -
performBulkOperationPreserveOrder
protected DbBulkOperation performBulkOperationPreserveOrder(Class<? extends DbEntity> entityType, String statement, Object parameter, DbOperationType operationType) -
performEntityOperation
-
close
public void close() -
isDeleted
-
ensureHasId
-
validateId
-
pruneDeletedEntities
-
contains
-
getDbOperationManager
-
setDbOperationManager
-
getDbEntityCache
-
setDbEntityCache
-
createDeploymentQuery
-
createProcessDefinitionQuery
-
createCaseDefinitionQuery
-
createProcessInstanceQuery
-
createExecutionQuery
-
createTaskQuery
-
createJobQuery
-
createHistoricProcessInstanceQuery
-
createHistoricActivityInstanceQuery
-
createHistoricTaskInstanceQuery
-
createHistoricDetailQuery
-
createHistoricVariableInstanceQuery
-
createHistoricJobLogQuery
-
createUserQuery
-
createGroupQuery
-
registerOptimisticLockingListener
-
getTableNamesPresentInDatabase
-