diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php
index 6aad04fb6..948a4e689 100644
--- a/lib/Doctrine/ORM/Tools/EntityGenerator.php
+++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -710,15 +710,9 @@ public function __construct()
         }
 
         // check traits for existing property
-        if (class_exists($metadata->name)) {
-            $reflClass = new \ReflectionClass($metadata->name);
-
-            if (method_exists($reflClass, 'getTraits')) {
-                foreach ($reflClass->getTraits() as $trait) {
-                    if ($trait->hasProperty($property)) {
-                        return true;
-                    }
-                }
+        foreach ($this->getTraits($metadata) as $trait) {
+            if ($trait->hasProperty($property)) {
+                return true;
             }
         }
 
@@ -746,15 +740,9 @@ public function __construct()
         }
 
         // check traits for existing method
-        if (class_exists($metadata->name)) {
-            $reflClass = new \ReflectionClass($metadata->name);
-
-            if (method_exists($reflClass, 'getTraits')) {
-                foreach ($reflClass->getTraits() as $trait) {
-                    if ($trait->hasMethod($method)) {
-                        return true;
-                    }
-                }
+        foreach ($this->getTraits($metadata) as $trait) {
+            if ($trait->hasMethod($method)) {
+                return true;
             }
         }
 
@@ -764,6 +752,26 @@ public function __construct()
         );
     }
 
+    /**
+     * @param ClassMetadataInfo $metadata
+     *
+     * @return array
+     */
+    protected function getTraits(ClassMetadataInfo $metadata)
+    {
+        if ($metadata->reflClass != null || class_exists($metadata->name)) {
+            $reflClass = $metadata->reflClass == null
+                ? new \ReflectionClass($metadata->name)
+                : $metadata->reflClass;
+
+            if (method_exists($reflClass, 'getTraits')) {
+                return $reflClass->getTraits();
+            }
+        }
+
+        return array();
+    }
+
     /**
      * @param ClassMetadataInfo $metadata
      *