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:
Michael Hirsch
2016-02-04 20:39:29 +01:00
parent fcff3e9917
commit f4c877103f

View File

@@ -1010,7 +1010,7 @@ public class TargetManagement {
@NotNull
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
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) {
throw new EntityAlreadyExistsException();
}