private static void validateMappedBy ( Attribute attr , Attribute mappedByAttr ) { if ( mappedByAttr != null ) { if ( ! isSingleReferenceType ( mappedByAttr ) ) { throw new MolgenisDataException ( format ( "Invalid mappedBy attribute [%s] data type [%s]." , mappedByAttr . getName ( ) , mappedByAttr . getDataType ( ) ) ) ; } Attribute refAttr = attr . getRefEntity ( ) . getAttribute ( mappedByAttr . getName ( ) ) ; if ( refAttr == null ) { throw new MolgenisDataException ( format ( "mappedBy attribute [%s] is not part of entity [%s]." , mappedByAttr . getName ( ) , attr . getRefEntity ( ) . getId ( ) ) ) ; } } }
Validate whether the mappedBy attribute is part of the referenced entity .