Join table supports property-ref keys (NH-1452, NH-1681)

Original patch provided by Daniel Guenter <nicaog@gmail.com> applied with code cleanup and fixes