protected void flushDbOperationManager() { // obtain totally ordered operation list from operation manager List<DbOperation> operationsToFlush = dbOperationManager.calculateFlush(); if (operationsToFlush == null || operationsToFlush.size() == 0) { return; } LOG.databaseFlushSummary(operationsToFlush); // If we want to delete all table data as bulk operation, on tables which have self references, // We need to turn the foreign key check off on MySQL and MariaDB. // On other databases we have to do nothing, the mapped statement will be empty. if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, false); persistenceSession.flushOperations(); } try { final List<List<DbOperation>> batches = CollectionUtil.partition(operationsToFlush, BATCH_SIZE); for (List<DbOperation> batch : batches) { flushDbOperations(batch); } } finally { if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, true); persistenceSession.flushOperations(); isIgnoreForeignKeysForNextFlush = false; } } }
protected void flushDbOperationManager() { // obtain totally ordered operation list from operation manager List<DbOperation> operationsToFlush = dbOperationManager.calculateFlush(); if (operationsToFlush == null || operationsToFlush.size() == 0) { return; } LOG.databaseFlushSummary(operationsToFlush); // If we want to delete all table data as bulk operation, on tables which have self references, // We need to turn the foreign key check off on MySQL and MariaDB. // On other databases we have to do nothing, the mapped statement will be empty. if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, false); persistenceSession.flushOperations(); } try { final List<List<DbOperation>> batches = CollectionUtil.partition(operationsToFlush, BATCH_SIZE); for (List<DbOperation> batch : batches) { flushDbOperations(batch); } } finally { if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, true); persistenceSession.flushOperations(); isIgnoreForeignKeysForNextFlush = false; } } }
protected void flushDbOperationManager() { // obtain totally ordered operation list from operation manager List<DbOperation> operationsToFlush = dbOperationManager.calculateFlush(); if (operationsToFlush == null || operationsToFlush.size() == 0) { return; } LOG.databaseFlushSummary(operationsToFlush); // If we want to delete all table data as bulk operation, on tables which have self references, // We need to turn the foreign key check off on MySQL and MariaDB. // On other databases we have to do nothing, the mapped statement will be empty. if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, false); persistenceSession.flushOperations(); } try { final List<List<DbOperation>> batches = CollectionUtil.partition(operationsToFlush, BATCH_SIZE); for (List<DbOperation> batch : batches) { flushDbOperations(batch); } } finally { if (isIgnoreForeignKeysForNextFlush) { persistenceSession.executeNonEmptyUpdateStmt(TOGGLE_FOREIGN_KEY_STMT, true); persistenceSession.flushOperations(); isIgnoreForeignKeysForNextFlush = false; } } }