diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php
index 451f2d5..d28e3fe 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityComment.php
@@ -11,7 +11,8 @@
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\migrate\Entity\MigrationInterface;
-use Drupal\migrate\Plugin\MigratePluginManager;
+use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\migrate\MigrateSkipRowException;
 use Drupal\migrate\Row;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -30,6 +31,20 @@ class EntityComment extends EntityContentBase {
   protected $state;
 
   /**
+   * The entity query object.
+   *
+   * @var \Drupal\Core\Entity\Query\QueryInterface
+   */
+  protected $entityQuery;
+
+  /**
+   * An array of entity Ids for the 'commented entity' keyed by entity type.
+   *
+   * @var array
+   */
+  protected $stubCommentedEntityIds;
+
+  /**
    * Builds an comment entity destination.
    *
    * @param array $configuration
@@ -44,16 +59,17 @@ class EntityComment extends EntityContentBase {
    *   The storage for this entity type.
    * @param array $bundles
    *   The list of bundles this entity type has.
-   * @param \Drupal\migrate\Plugin\MigratePluginManager $plugin_manager
-   *   The migrate plugin manager.
    * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
    *   The entity manager service.
    * @param \Drupal\Core\State\StateInterface $state
    *   The state storage object.
+   * @param \Drupal\Core\Entity\Query\QueryFactory $entity_query
+   *   The query object that can query the given entity type.
    */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, StateInterface $state) {
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EntityStorageInterface $storage, array $bundles, EntityManagerInterface $entity_manager, StateInterface $state, QueryFactory $entity_query) {
     parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $entity_manager);
     $this->state = $state;
+    $this->entityQuery = $entity_query;
   }
 
   /**
@@ -69,7 +85,8 @@ public static function create(ContainerInterface $container, array $configuratio
       $container->get('entity.manager')->getStorage($entity_type),
       array_keys($container->get('entity.manager')->getBundleInfo($entity_type)),
       $container->get('entity.manager'),
-      $container->get('state')
+      $container->get('state'),
+      $container->get('entity.query')
     );
   }
 
@@ -87,4 +104,51 @@ public function import(Row $row, array $old_destination_id_values = array()) {
     return $return;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  protected function getEntity(Row $row, array $old_destination_id_values) {
+    if ($row->stub()) {
+      $this->processStubRow($row);
+    }
+
+    return parent::getEntity($row, $old_destination_id_values);
+  }
+
+  /**
+   * Specific processing for stub rows.
+   *
+   * @param \Drupal\migrate\Row $row
+   *   The row object.
+   *
+   * @throws \Drupal\migrate\MigrateSkipRowException
+   */
+  protected function processStubRow(Row $row) {
+    $stub_commented_entity_type = $row->getDestinationProperty('entity_type');
+
+    // While parent::getEntity() fills the bundle property for stub entities
+    // if it's still empty, here we must also make sure entity_id/entity_type
+    // are filled (so $comment->getCommentedEntity() always returns a value).
+    if (empty($this->stubCommentedEntityIds[$stub_commented_entity_type])) {
+
+      // Fill stub entity id. Any id will do, as long as it exists.
+      $entity_type = $this->entityManager->getDefinition($stub_commented_entity_type);
+      if ($id_key = $entity_type->getKey('id')) {
+        $result = $this->entityQuery
+          ->get($stub_commented_entity_type)
+          ->range(0, 1)
+          ->execute();
+        if ($result) {
+          $this->stubCommentedEntityIds[$stub_commented_entity_type] = array_pop($result);
+        }
+      }
+    }
+    if (empty($this->stubCommentedEntityIds[$stub_commented_entity_type])) {
+      throw new MigrateSkipRowException(t('Could not derive commented entity for comment %id', array('%id' => implode(':', $row->getSourceIdValues()))));
+    }
+
+    $row->setDestinationProperty('entity_id', $this->stubCommentedEntityIds[$stub_commented_entity_type]);
+    $row->setDestinationProperty('entity_type', $stub_commented_entity_type);
+  }
+
 }
diff --git a/core/modules/migrate/src/Plugin/migrate/process/Migration.php b/core/modules/migrate/src/Plugin/migrate/process/Migration.php
index 0fb0dc9..dcec0f6 100644
--- a/core/modules/migrate/src/Plugin/migrate/process/Migration.php
+++ b/core/modules/migrate/src/Plugin/migrate/process/Migration.php
@@ -122,6 +122,14 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro
       foreach (array_keys($source_ids) as $index => $source_id) {
         $values[$source_id] = $source_id_values[$migration->id()][$index];
       }
+      // If we have constants in the source then add them to the values and the
+      // process array.
+      if (isset($migration->get('source')['constants'])) {
+        $constants = $migration->get('source')['constants'];
+        $values += $constants;
+        $process += array_combine(array_keys($constants), array_keys($constants));
+      }
+
       $stub_row = new Row($values, $source_ids);
       $stub_row->stub(TRUE);
       // Do a normal migration with the stub row.
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
index c1e9273..10c2fc3 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateCommentTest.php
@@ -19,7 +19,10 @@
  */
 class MigrateCommentTest extends MigrateDrupalTestBase {
 
-  static $modules = array('node', 'comment');
+  // Directly testing that comments' entity_id is populated upon importing is
+  // not straightforward, but RDF module serves as an implicit test;
+  // its hook_comment_storage_load() references $comment->getCommentedEntity().
+  static $modules = array('node', 'comment', 'rdf');
 
   /**
    * {@inheritdoc}
