Remove unnecessary lookup of an entity via the session

Closes #11744
This commit is contained in:
Alexander Schwartz 2022-10-24 15:39:47 +02:00 committed by Hynek Mlnařík
parent cac4c43052
commit 9f95b6ec63

View file

@ -353,9 +353,7 @@ public class MapClientProvider implements ClientProvider {
try (Stream<MapClientEntity> toRemove = tx.read(withCriteria(mcb))) {
toRemove
.map(clientEntity -> session.clients().getClientById(realm, clientEntity.getId()))
.filter(Objects::nonNull)
.forEach(clientModel -> clientModel.deleteScopeMapping(role));
.forEach(clientEntity -> clientEntity.removeScopeMapping(role.getId()));
}
}