MIFOSX-932 - chaged the query to fetch hierarchy