fix empty in statement of count select when using mysql. Do empty check
of list. Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
@@ -1010,7 +1010,7 @@ public class TargetManagement {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||||
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
public List<Target> createTargets(@NotNull final List<Target> targets) {
|
||||||
if (targetRepository.countByControllerIdIn(
|
if (!targets.isEmpty() && targetRepository.countByControllerIdIn(
|
||||||
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList())) > 0) {
|
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList())) > 0) {
|
||||||
throw new EntityAlreadyExistsException();
|
throw new EntityAlreadyExistsException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user