code: public static String getMappedName(EntityMetadata parentMetadata, Relation relation,
              final KunderaMetadata kunderaMetadata)
      {
          if (relation != null)
          {
              String joinColumn = relation.getJoinColumnName(kunderaMetadata);
              if (joinColumn == null)
              {
                  Class clazz = relation.getTargetEntity();
                  EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, clazz);
  
                  joinColumn = relation.getType().equals(ForeignKey.ONE_TO_MANY) ? ((AbstractAttribute) parentMetadata
                          .getIdAttribute()).getJPAColumnName() : ((AbstractAttribute) metadata.getIdAttribute())
                          .getJPAColumnName();
              }
              return joinColumn;
          }
          return null;
      }
docs: Returns mapped relational name, in case of bi directional mapping, it
  will return back pKey name of associated entity.
  
  @param relation
  holding relation.
  @return mapped/join column name.