Merge pull request #2958 from mposolda/master

Fix ResourceManagementTest.testFindById to pass with other RDBMS besi…
This commit is contained in:
Marek Posolda 2016-06-23 10:57:40 +02:00 committed by GitHub
commit e205535c55

View file

@ -29,6 +29,8 @@ import javax.persistence.NoResultException;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
@ -129,6 +131,10 @@ public class JPAPolicyStore implements PolicyStore {
@Override
public List<Policy> findByScopeIds(List<String> scopeIds, String resourceServerId) {
if (scopeIds==null || scopeIds.isEmpty()) {
return Collections.emptyList();
}
Query query = getEntityManager().createQuery("select p from PolicyEntity p inner join p.scopes s where p.resourceServer.id = :serverId and s.id in (:scopeIds) and p.resources is empty group by p.id order by p.name");
query.setParameter("serverId", resourceServerId);