diff --git a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java index 951cdb313..7a8667eab 100644 --- a/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java +++ b/metacat-metadata-mysql/src/main/java/com/netflix/metacat/metadata/mysql/MySqlParentChildRelMetaDataService.java @@ -100,22 +100,26 @@ public void createParentChildRelation(final QualifiedName parentName, @Override public void rename(final QualifiedName oldName, final QualifiedName newName) { try { - retryTemplate.execute((RetryCallback) context -> { - jdbcTemplate.update(connection -> { + // Retry for renaming the Parent Entity + retryTemplate.execute((RetryCallback) context -> { + return jdbcTemplate.update(connection -> { // Rename Parent Entity final PreparedStatement renameParentPS = connection.prepareStatement(SQL_RENAME_PARENT_ENTITY); renameParentPS.setString(1, newName.toString()); renameParentPS.setString(2, oldName.toString()); - renameParentPS.executeUpdate(); + return renameParentPS; + }); + }); + // Retry for renaming the Child Entity + retryTemplate.execute((RetryCallback) context -> { + return jdbcTemplate.update(connection -> { // Rename Child Entity final PreparedStatement renameChildPS = connection.prepareStatement(SQL_RENAME_CHILD_ENTITY); renameChildPS.setString(1, newName.toString()); renameChildPS.setString(2, oldName.toString()); - renameChildPS.executeUpdate(); - return null; + return renameChildPS; }); - return null; }); } catch (RuntimeException e) { log.error("Failed to rename entity", e);