(List<TagEntity>) entityManager.createQuery(...
will be enough , as you just iterate through it below.