Walk entity references in Where and Match
Fixed a bug where reversed mapping option `:via` generates wrong join queries