OPENJPA-2330: Stackoverflow due to endless recursive calls - back ported to 2.2.x Rick Cutis's changes to trunk.