code: private void onRelation(final Object entity, final Map<String, Object> relationsMap, final EntityMetadata m,
              final PersistenceDelegator pd, Relation relation, ForeignKey relationType, boolean lazilyloaded,
              Map<Object, Object> relationStack)
      {
  
          FetchType fetchType = relation.getFetchType();
  
          if (!lazilyloaded && fetchType.equals(FetchType.LAZY))
          {
              final Object entityId = PropertyAccessorHelper.getId(entity, m);
              getAssociationBuilder().setProxyRelationObject(entity, relationsMap, m, pd, entityId, relation);
          }
          else
          {
              if (relation.getType().equals(ForeignKey.MANY_TO_MANY))
              {
                  // First, Save this entity to persistence cache
                  Field f = relation.getProperty();
                  Object object = PropertyAccessorHelper.getObject(entity, f);
                  final Object entityId = PropertyAccessorHelper.getId(entity, m);
                  PersistenceCacheManager.addEntityToPersistenceCache(entity, pd, entityId);
                  getAssociationBuilder().populateRelationForM2M(entity, m, pd, relation, object, relationsMap);
              }
              else
              {
                  onRelation(entity, relationsMap, relation, m, pd, lazilyloaded, relationStack);
              }
          }
      }
docs: Parse over each relation of fetched entity.
  
  @param entity
  @param relationsMap
  @param m
  @param pd
  @param relation
  @param relationType
  @param lazilyloaded
  @param relationStack