diff --git a/src/dgraph/entity.cpp b/src/dgraph/entity.cpp
index 8b37740f99a9fa02e1344b1cd495f781375016db..bbda49a4f01821e4ea09056e389864f65441c8bf 100644
--- a/src/dgraph/entity.cpp
+++ b/src/dgraph/entity.cpp
@@ -59,7 +59,7 @@ Entity( const string& name__ )
   if( name.length ()==0 )
     {
       stringstream oss; oss << rand ();
-      name = CLASS_NAME;
+      name = this->getClassName();
       name+="::";
       name+=oss.str ();
     }