diff --git a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
index ee45c7d..6e705d6 100644
--- a/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
+++ b/core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php
@@ -117,4 +117,16 @@ public function defaultValuesFormSubmit(array $element, array &$form, FormStateI
     return $default_value;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getConstraints() {
+    $constraints = parent::getConstraints();
+    $constraints[] = \Drupal::typedDataManager()
+      ->getValidationConstraintManager()
+      ->create('EntityReferenceNotNull', []);
+    return $constraints;
+  }
+
+
 }
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
index fa0b4a0..6ff9e10 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
@@ -39,13 +39,6 @@
 class EntityReferenceItem extends FieldItemBase {
 
   /**
-   * Marker value to identify a newly created entity.
-   *
-   * @var int
-   */
-  protected static $NEW_ENTITY_MARKER = -1;
-
-  /**
    * {@inheritdoc}
    */
   public static function defaultStorageSettings() {
@@ -89,7 +82,6 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
       $target_id_definition = DataDefinition::create('string')
         ->setLabel(t('@label ID', array($target_type_info->getLabel())));
     }
-    $target_id_definition->setRequired(TRUE);
     $properties['target_id'] = $target_id_definition;
 
     $properties['entity'] = DataReferenceDefinition::create('entity')
@@ -182,7 +174,7 @@ public function setValue($values, $notify = TRUE) {
         // its actual id and target_id will be different, due to the new entity
         // marker.
         $entity_id = $this->get('entity')->getTargetIdentifier();
-        if ($entity_id != $values['target_id'] && ($values['target_id'] != static::$NEW_ENTITY_MARKER || !$this->entity->isNew())) {
+        if ($entity_id != $values['target_id'] && (!$this->entity->isNew())) {
           throw new \InvalidArgumentException('The target id and entity passed to the entity reference item do not match.');
         }
       }
@@ -215,10 +207,10 @@ public function onChange($property_name, $notify = TRUE) {
     // Make sure that the target ID and the target property stay in sync.
     if ($property_name == 'entity') {
       $property = $this->get('entity');
-      $target_id = $property->isTargetNew() ? static::$NEW_ENTITY_MARKER : $property->getTargetIdentifier();
+      $target_id = $property->isTargetNew() ? NULL : $property->getTargetIdentifier();
       $this->writePropertyValue('target_id', $target_id);
     }
-    elseif ($property_name == 'target_id' && $this->target_id != static::$NEW_ENTITY_MARKER) {
+    elseif ($property_name == 'target_id' && $this->target_id) {
       $this->writePropertyValue('entity', $this->target_id);
     }
     parent::onChange($property_name, $notify);
@@ -229,10 +221,7 @@ public function onChange($property_name, $notify = TRUE) {
    */
   public function isEmpty() {
     // Avoid loading the entity by first checking the 'target_id'.
-    if ($this->target_id !== NULL) {
-      return FALSE;
-    }
-    if ($this->entity && $this->entity instanceof EntityInterface) {
+    if ($this->target_id !== NULL || (($entity = $this->entity) && $entity instanceof EntityInterface)) {
       return FALSE;
     }
     return TRUE;
@@ -247,9 +236,11 @@ public function preSave() {
       if ($this->entity->isNew()) {
         $this->entity->save();
       }
+    }
+    if ($this->entity && ($id = $this->entity->id()) && $this->target_id !== $id) {
       // Make sure the parent knows we are updating this property so it can
       // react properly.
-      $this->target_id = $this->entity->id();
+      $this->target_id = $id;
     }
   }
 
@@ -276,7 +267,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
    *   TRUE if the item holds an unsaved entity.
    */
   public function hasNewEntity() {
-    return $this->target_id === static::$NEW_ENTITY_MARKER;
+    return !$this->isEmpty() && $this->target_id === NULL && $this->entity->isNew();
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraint.php
new file mode 100644
index 0000000..c7c3a70
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraint.php
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Validation\Plugin\Validation\Constraint\EntityReferenceNotNullConstraint.
+ */
+
+namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
+
+
+/**
+ * EntityReferenceNotNull constraint.
+ *
+ * @Constraint(
+ *   id = "EntityReferenceNotNull",
+ *   label = @Translation("EntityReferenceNotNull", context = "Validation"),
+ *   type = false
+ * )
+ */
+class EntityReferenceNotNullConstraint extends NotNullConstraint {
+}
diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraintValidator.php
new file mode 100644
index 0000000..b340bd6
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityReferenceNotNullConstraintValidator.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Validation\Plugin\Validation\Constraint\EntityReferenceNotNullConstraintValidator.
+ */
+
+namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
+
+use Drupal\Core\TypedData\ComplexDataInterface;
+use Drupal\Core\TypedData\ListInterface;
+use Drupal\Core\TypedData\Validation\TypedDataAwareValidatorTrait;
+use Symfony\Component\Validator\Constraint;
+use Symfony\Component\Validator\Constraints\NotNullValidator;
+
+/**
+ * EntityReferenceNotNull constraint validator.
+ */
+class EntityReferenceNotNullConstraintValidator extends NotNullValidator {
+
+  use TypedDataAwareValidatorTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function validate($value, Constraint $constraint) {
+    foreach ($value as $item) {
+      if ($item->isEmpty()) {
+        continue;
+      }
+      if (!$item->target_id && !$item->entity->isNew()) {
+        $this->context->addViolation($constraint->message);
+        return;
+      }
+    }
+  }
+
+}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
index 4601c34..c47a84a 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
@@ -11,8 +11,8 @@
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\FieldItemInterface;
 use Drupal\Core\Language\LanguageInterface;
-use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
 use Drupal\entity_test\Entity\EntityTest;
+use Drupal\entity_reference\Tests\EntityReferenceTestTrait;
 use Drupal\entity_test\Entity\EntityTestStringId;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -228,6 +228,30 @@ public function testConfigEntityReferenceItem() {
   }
 
   /**
+   * Tests entity auto create.
+   */
+  public function testEntityAutoCreate() {
+    // The term entity is unsaved here.
+    $term = Term::create(array(
+      'name' => $this->randomMachineName(),
+      'vid' => $this->term->bundle(),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $entity = EntityTest::create();
+    // Now assign the unsaved term to the field.
+    $entity->field_test_taxonomy_term->entity = $term;
+    $entity->name->value = $this->randomMachineName();
+    // This is equal to storing an entity to tempstore or cache and retrieving
+    // it back. An example for this is node preview.
+    $entity = serialize($entity);
+    $entity = unserialize($entity);
+    // And then the entity.
+    $entity->save();
+    $term = \Drupal::entityManager()->loadEntityByUuid($term->getEntityTypeId(), $term->uuid());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
+  }
+
+  /**
    * Test saving order sequence doesn't matter.
    */
   public function testEntitySaveOrder() {
