diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java index 01486609ce1..2b19546dcd4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java @@ -84,6 +84,7 @@ import java.time.format.DateTimeParseException; import java.time.temporal.TemporalAccessor; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -1981,6 +1982,12 @@ public abstract class EntityRepository { } // populate owner entityRefs with all fields List refs = validateOwners(owners); + if (nullOrEmpty(refs)) { + return; + } + refs.sort(Comparator.comparing(EntityReference::getName)); + owners.sort(Comparator.comparing(EntityReference::getName)); + for (int i = 0; i < owners.size(); i++) { EntityUtil.copy(refs.get(i), owners.get(i)); }