code: void populateRelationForM2M(Object entity, EntityMetadata entityMetadata, PersistenceDelegator delegator,
              Relation relation, Object relObject, Map<String, Object> relationsMap)
      {
          // For M-M relationship of Collection type, relationship entities are
          // always fetched from Join Table.
          if (relation.getPropertyType().isAssignableFrom(List.class)
                  || relation.getPropertyType().isAssignableFrom(Set.class))
          {
              if (relation.isRelatedViaJoinTable() && (relObject == null || ProxyHelper.isProxyOrCollection(relObject)))
              {
                  populateCollectionFromJoinTable(entity, entityMetadata, delegator, relation);
              }
  
          }
          else if (relation.getPropertyType().isAssignableFrom(Map.class))
          {
              if (relation.isRelatedViaJoinTable())
              {
                  // TODO: Implement Map relationships via Join Table (not
                  // supported as of now)
              }
              else
              {
                  populateCollectionFromMap(entity, delegator, relation, relObject, relationsMap);
              }
          }
      }
docs: Populates entities related via join table for <code>entity</code>
  
  @param entity
  @param entityMetadata
  @param delegator
  @param relation