Don't try to manage associations of empty lists

This commit is contained in:
2023-05-12 16:40:50 -05:00
parent 4e5fd62808
commit 298e73e144
2 changed files with 16 additions and 10 deletions

View File

@ -369,6 +369,8 @@ public class DeleteAction
QueryOutput queryOutput = new QueryAction().execute(queryInput);
List<Serializable> associatedKeys = queryOutput.getRecords().stream().map(r -> r.getValue(associatedTable.getPrimaryKeyField())).toList();
if(CollectionUtils.nullSafeHasContents(associatedKeys))
{
DeleteInput nextLevelDeleteInput = new DeleteInput();
nextLevelDeleteInput.setTransaction(deleteInput.getTransaction());
nextLevelDeleteInput.setTableName(association.getAssociatedTableName());
@ -376,6 +378,7 @@ public class DeleteAction
DeleteOutput nextLevelDeleteOutput = new DeleteAction().execute(nextLevelDeleteInput);
}
}
}

View File

@ -239,6 +239,8 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
}
}
if(CollectionUtils.nullSafeHasContents(nextLevelInserts))
{
InsertInput nextLevelInsertInput = new InsertInput();
nextLevelInsertInput.setTransaction(transaction);
nextLevelInsertInput.setTableName(association.getAssociatedTableName());
@ -246,6 +248,7 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
InsertOutput nextLevelInsertOutput = new InsertAction().execute(nextLevelInsertInput);
}
}
}