diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
index f8138de..e6d8fe6 100644
--- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
+++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
@@ -9,7 +9,6 @@
 
 use PDO;
 use Drupal\Core\Entity\Query\QueryInterface;
-use Exception;
 use Drupal\Component\Uuid\Uuid;
 use Drupal\Component\Utility\NestedArray;
 
@@ -492,7 +491,7 @@ public function delete(array $entities) {
       // Ignore slave server temporarily.
       db_ignore_slave();
     }
-    catch (Exception $e) {
+    catch (\Exception $e) {
       $transaction->rollback();
       watchdog_exception($this->entityType, $e);
       throw new EntityStorageException($e->getMessage, $e->getCode, $e);
@@ -548,7 +547,7 @@ public function save(EntityInterface $entity) {
 
       return $return;
     }
-    catch (Exception $e) {
+    catch (\Exception $e) {
       $transaction->rollback();
       watchdog_exception($this->entityType, $e);
       throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
index 875b7a2..fd8248e 100644
--- a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
+++ b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
@@ -217,7 +217,7 @@ public function save(EntityInterface $entity) {
 
       return $return;
     }
-    catch (Exception $e) {
+    catch (\Exception $e) {
       $transaction->rollback();
       watchdog_exception($this->entityType, $e);
       throw new EntityStorageException($e->getMessage(), $e->getCode(), $e);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
index 91c292c..db722bb 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\system\Tests\Entity;
 
 use Drupal\simpletest\WebTestBase;
+use Drupal\Core\Database\Database;
 
 /**
  * Tests invocation of hooks when performing an action.
@@ -28,7 +29,7 @@ class EntityCrudHookTest extends WebTestBase {
    *
    * @var array
    */
-  public static $modules = array('entity_crud_hook_test', 'taxonomy', 'comment', 'file');
+  public static $modules = array('entity_crud_hook_test', 'taxonomy', 'comment', 'file', 'entity_test');
 
   protected $ids = array();
 
@@ -409,4 +410,29 @@ public function testUserHooks() {
       'entity_crud_hook_test_entity_delete called for type user',
     ));
   }
+
+  /**
+   * Tests rollback from failed insert in EntityNG.
+   */
+  function testEntityNGRollback() {
+    // Create a block.
+    try {
+      $entity = entity_create('entity_test', array('name' => 'fail_insert'))->save();
+      $this->fail('Expected exception has not been thrown.');
+    }
+    catch (\Exception $e) {
+      $this->pass('Expected exception has been thrown.');
+    }
+
+    if (Database::getConnection()->supportsTransactions()) {
+      // Check that the block does not exist in the database.
+      $ids = entity_query('entity_test')->condition('name', 'fail_insert')->execute();
+      $this->assertTrue(empty($ids), 'Transactions supported, and entity not found in database.');
+    }
+    else {
+      // Check that the block exists in the database.
+      $ids = entity_query('entity_test')->condition('name', 'fail_insert')->execute();
+      $this->assertFalse(empty($ids), 'Transactions not supported, and entity found in database.');
+    }
+  }
 }
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index f2b5b38..9063614 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -169,3 +169,12 @@ function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) {
   $langcode = $form_state['controller']->getFormLangcode($form_state);
   variable_set('entity_form_langcode', $langcode);
 }
+
+/**
+ * Implements hook_ENTITY_TYPE_insert().
+ */
+function entity_test_entity_test_insert($entity) {
+  if ($entity->name->value == 'fail_insert') {
+    throw new Exception("Test exception rollback.");
+  }
+}
