code: private String getTargetTable(ClassDescriptorDef targetClassDef, String indirectionTable, String foreignKeys)
      {
          ModelDef modelDef  = (ModelDef)targetClassDef.getOwner();
          String   tableName = null;
  
          for (Iterator classIt = modelDef.getClasses(); classIt.hasNext();)
          {
              ClassDescriptorDef curClassDef = (ClassDescriptorDef)classIt.next();
  
              if (!curClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_GENERATE_TABLE_INFO, true))
              {
                  continue;
              }
              for (Iterator collIt = curClassDef.getCollections(); collIt.hasNext();)
              {
                  CollectionDescriptorDef curCollDef = (CollectionDescriptorDef)collIt.next();
  
                  if (!indirectionTable.equals(curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE)) ||
                      !CommaListIterator.sameLists(foreignKeys, curCollDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)))
                  {
                      continue;
                  }
                  // ok, collection fits
                  if (tableName != null)
                  {
                      if (!tableName.equals(curClassDef.getProperty(PropertyHelper.OJB_PROPERTY_TABLE)))
                      {
                          // maps to a different table
                          return null;
                      }
                  }
                  else
                  {
                      tableName = curClassDef.getProperty(PropertyHelper.OJB_PROPERTY_TABLE);
                  }
              }
          }
          if (tableName == null)
          {
              // no fitting collection found -> indirection table with only one collection
              // we have to check whether the hierarchy of the target class maps to one table only
              return getHierarchyTable(targetClassDef);
          }
          else
          {
              return tableName;
          }
      }
docs: Tries to return the single target table to which the given foreign key columns map in
  all m:n collections that target this indirection table.
  
  @param targetClassDef   The original target class
  @param indirectionTable The indirection table
  @param foreignKeys      The foreign keys columns in the indirection table pointing back to the
  class' table
  @return The table name or <code>null</code> if there is not exactly one table