JpaSystemScopeRepository: Fix JPA expectations
parent
ce1ea638ee
commit
7dc3b8ec3a
|
@ -23,6 +23,7 @@ package org.mitre.oauth2.repository.impl;
|
||||||
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
|
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
|
||||||
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
|
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -79,6 +80,10 @@ public class JpaSystemScopeRepository implements SystemScopeRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<SystemScope> getByValues(Set<String> values) {
|
public Set<SystemScope> getByValues(Set<String> values) {
|
||||||
|
if(values.isEmpty()) {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
TypedQuery<SystemScope> query = em.createNamedQuery(SystemScope.QUERY_BY_VALUES, SystemScope.class);
|
TypedQuery<SystemScope> query = em.createNamedQuery(SystemScope.QUERY_BY_VALUES, SystemScope.class);
|
||||||
query.setParameter(SystemScope.PARAM_VALUE, values);
|
query.setParameter(SystemScope.PARAM_VALUE, values);
|
||||||
return new HashSet<>(query.getResultList());
|
return new HashSet<>(query.getResultList());
|
||||||
|
|
Loading…
Reference in New Issue