KEYCLOAK-21868 (#22373)
Add the realm Id as a param to named query getGoupIdsByParent in order to use (or make better use of) the SIBLING_NAMES index on KEYCLOAK_GROUP table. Closes #21868
This commit is contained in:
parent
c18475fc57
commit
6db0bc5428
2 changed files with 2 additions and 1 deletions
|
@ -122,6 +122,7 @@ public class GroupAdapter implements GroupModel , JpaModel<GroupEntity> {
|
|||
@Override
|
||||
public Stream<GroupModel> getSubGroupsStream() {
|
||||
TypedQuery<String> query = em.createNamedQuery("getGroupIdsByParent", String.class);
|
||||
query.setParameter("realm", group.getRealm());
|
||||
query.setParameter("parent", group.getId());
|
||||
return closing(query.getResultStream().map(realm::getGroupById).filter(Objects::nonNull));
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.LinkedList;
|
|||
* @version $Revision: 1 $
|
||||
*/
|
||||
@NamedQueries({
|
||||
@NamedQuery(name="getGroupIdsByParent", query="select u.id from GroupEntity u where u.parentId = :parent order by u.name ASC"),
|
||||
@NamedQuery(name="getGroupIdsByParent", query="select u.id from GroupEntity u where u.realm = :realm and u.parentId = :parent order by u.name ASC"),
|
||||
@NamedQuery(name="getGroupIdsByRealm", query="select u.id from GroupEntity u where u.realm = :realm order by u.name ASC"),
|
||||
@NamedQuery(name="getGroupIdsByNameContaining", query="select u.id from GroupEntity u where u.realm = :realm and u.name like concat('%',:search,'%') order by u.name ASC"),
|
||||
@NamedQuery(name="getGroupIdsByNameContainingFromIdList", query="select u.id from GroupEntity u where u.realm = :realm and lower(u.name) like lower(concat('%',:search,'%')) and u.id in :ids order by u.name ASC"),
|
||||
|
|
Loading…
Reference in a new issue