read hierarchy from the DB