diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java index 3cb25db5c02..5a2a00b1349 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TableRepository.java @@ -598,7 +598,7 @@ public class TableRepository extends EntityRepository { } public Table addDataModel(UUID tableId, DataModel dataModel) { - Table table = find(tableId, NON_DELETED); + Table table = get(null, tableId, getFields(FIELD_OWNERS), NON_DELETED, false); // Update the sql fields only if correct value is present if (dataModel.getRawSql() == null || dataModel.getRawSql().isBlank()) { @@ -618,7 +618,7 @@ public class TableRepository extends EntityRepository
{ table.withDataModel(dataModel); // Carry forward the table owners from the model to table entity, if empty - if (table.getOwners() == null) { + if (nullOrEmpty(table.getOwners())) { storeOwners(table, dataModel.getOwners()); }