@RequiresSession
  public List<UserEntity> findUsersByPrincipal(List<PrincipalEntity> principalList) {
    TypedQuery<UserEntity> query = entityManagerProvider.get().createQuery(
        "SELECT user_entity FROM UserEntity user_entity WHERE user_entity.principal IN :principalList", UserEntity.class);

    List<UserEntity> result = new ArrayList<>();
    SQLOperations.batch(principalList, SQLConstants.IN_ARGUMENT_MAX_SIZE, (chunk, currentBatch, totalBatches, totalSize) -> {
      query.setParameter("principalList", chunk);
      result.addAll(daoUtils.selectList(query));
      return 0;
    });
    return Lists.newArrayList(result);
  }
Find the user entities for the given list of admin principal entities.

@param principalList the list of principal entities
@return the matching list of user entities
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java