Mapping self-relationships when using custom query

Please avoid cross-posting. We are very aware of activities on GitHub.