RelationshipQuery query = rm.createRelationshipQuery(Grant.class); query.setParameter(Grant.ASSIGNEE, groups.toArray(new Group[groups.size()])); return query.getResultList();
did some RCA and found that the entire entity is getting loaded and it is a performance hit, hence create native queries to get groupRoles .