@Override protected void deleteEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); // get statement String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass()); ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement); LOG.executeDatabaseOperation("DELETE", dbEntity); // execute the delete int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity); operation.setRowsAffected(nrOfRowsDeleted); // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) { operation.setFailed(true); return; } // perform post delete action entityDeleted(dbEntity); }
@Override protected void deleteEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); // get statement String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass()); ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement); LOG.executeDatabaseOperation("DELETE", dbEntity); // execute the delete int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity); operation.setRowsAffected(nrOfRowsDeleted); // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) { operation.setFailed(true); return; } // perform post delete action entityDeleted(dbEntity); }
final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { ((DbEntityOperation) thisOperation).setFailed(true); handleOptimisticLockingException(thisOperation); } else {
final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { ((DbEntityOperation) thisOperation).setFailed(true); handleOptimisticLockingException(thisOperation); } else {
@Override protected void updateEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity); ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement); LOG.executeDatabaseOperation("UPDATE", dbEntity); if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) { // execute update executeUpdate(updateStatement, dbEntity); } else { // execute update int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity); if (dbEntity instanceof HasDbRevision) { if (numOfRowsUpdated != 1) { // failed with optimistic locking operation.setFailed(true); return; } else { // increment revision of our copy HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext()); } } } // perform post update action entityUpdated(dbEntity); }
@Override protected void updateEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity); ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement); LOG.executeDatabaseOperation("UPDATE", dbEntity); if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) { // execute update executeUpdate(updateStatement, dbEntity); } else { // execute update int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity); if (dbEntity instanceof HasDbRevision) { if (numOfRowsUpdated != 1) { // failed with optimistic locking operation.setFailed(true); return; } else { // increment revision of our copy HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext()); } } } // perform post update action entityUpdated(dbEntity); }
@Override protected void deleteEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); // get statement String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass()); ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement); LOG.executeDatabaseOperation("DELETE", dbEntity); // execute the delete int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity); operation.setRowsAffected(nrOfRowsDeleted); // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) { operation.setFailed(true); return; } // perform post delete action entityDeleted(dbEntity); }
final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity(); if (statementResult != 1) { ((DbEntityOperation) thisOperation).setFailed(true); handleOptimisticLockingException(thisOperation); } else {
@Override protected void updateEntity(DbEntityOperation operation) { final DbEntity dbEntity = operation.getEntity(); String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity); ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement); LOG.executeDatabaseOperation("UPDATE", dbEntity); if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) { // execute update executeUpdate(updateStatement, dbEntity); } else { // execute update int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity); if (dbEntity instanceof HasDbRevision) { if (numOfRowsUpdated != 1) { // failed with optimistic locking operation.setFailed(true); return; } else { // increment revision of our copy HasDbRevision versionedObject = (HasDbRevision) dbEntity; versionedObject.setRevision(versionedObject.getRevisionNext()); } } } // perform post update action entityUpdated(dbEntity); }