mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Don't try to manage associations of empty lists
This commit is contained in:
@ -369,11 +369,14 @@ public class DeleteAction
|
|||||||
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
||||||
List<Serializable> associatedKeys = queryOutput.getRecords().stream().map(r -> r.getValue(associatedTable.getPrimaryKeyField())).toList();
|
List<Serializable> associatedKeys = queryOutput.getRecords().stream().map(r -> r.getValue(associatedTable.getPrimaryKeyField())).toList();
|
||||||
|
|
||||||
DeleteInput nextLevelDeleteInput = new DeleteInput();
|
if(CollectionUtils.nullSafeHasContents(associatedKeys))
|
||||||
nextLevelDeleteInput.setTransaction(deleteInput.getTransaction());
|
{
|
||||||
nextLevelDeleteInput.setTableName(association.getAssociatedTableName());
|
DeleteInput nextLevelDeleteInput = new DeleteInput();
|
||||||
nextLevelDeleteInput.setPrimaryKeys(associatedKeys);
|
nextLevelDeleteInput.setTransaction(deleteInput.getTransaction());
|
||||||
DeleteOutput nextLevelDeleteOutput = new DeleteAction().execute(nextLevelDeleteInput);
|
nextLevelDeleteInput.setTableName(association.getAssociatedTableName());
|
||||||
|
nextLevelDeleteInput.setPrimaryKeys(associatedKeys);
|
||||||
|
DeleteOutput nextLevelDeleteOutput = new DeleteAction().execute(nextLevelDeleteInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,11 +239,14 @@ public class InsertAction extends AbstractQActionFunction<InsertInput, InsertOut
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertInput nextLevelInsertInput = new InsertInput();
|
if(CollectionUtils.nullSafeHasContents(nextLevelInserts))
|
||||||
nextLevelInsertInput.setTransaction(transaction);
|
{
|
||||||
nextLevelInsertInput.setTableName(association.getAssociatedTableName());
|
InsertInput nextLevelInsertInput = new InsertInput();
|
||||||
nextLevelInsertInput.setRecords(nextLevelInserts);
|
nextLevelInsertInput.setTransaction(transaction);
|
||||||
InsertOutput nextLevelInsertOutput = new InsertAction().execute(nextLevelInsertInput);
|
nextLevelInsertInput.setTableName(association.getAssociatedTableName());
|
||||||
|
nextLevelInsertInput.setRecords(nextLevelInserts);
|
||||||
|
InsertOutput nextLevelInsertOutput = new InsertAction().execute(nextLevelInsertInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user