object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java
public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
    underlying.checkIfActive();

    checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_CREATE, iClassName);

    try {
      Class<?> entityClass = entityManager.getEntityClass(iClassName);
      if (entityClass != null) {
        RET enhanced = (RET) OObjectEntityEnhancer.getInstance()
            .getProxiedInstance(entityManager.getEntityClass(iClassName), iEnclosingClass, underlying.newInstance(iClassName), null,
                iArgs);
        return (RET) enhanced;
      } else {
        throw new OSerializationException("Type " + iClassName
            + " cannot be serialized because is not part of registered entities. To fix this error register this class");
      }
    } catch (Exception e) {
      final String message = "Error on creating object of class " + iClassName;
      OLogManager.instance().error(this, message, e);

      throw OException.wrapException(new ODatabaseException(message), e);
    }
  }
public <RET extends Object> RET newInstance(final String iClassName, final Object iEnclosingClass, Object... iArgs) {
    underlying.checkIfActive();

    checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_CREATE, iClassName);

    try {
      Class<?> entityClass = entityManager.getEntityClass(iClassName);
      if (entityClass != null) {
        RET enhanced = (RET) OObjectEntityEnhancer.getInstance()
            .getProxiedInstance(entityManager.getEntityClass(iClassName), iEnclosingClass, underlying.newInstance(iClassName), null,
                iArgs);
        return (RET) enhanced;
      } else {
        throw new OSerializationException("Type " + iClassName
            + " cannot be serialized because is not part of registered entities. To fix this error register this class");
      }
    } catch (Exception e) {
      final String message = "Error on creating object of class " + iClassName;
      OLogManager.instance().error(this, message, e);

      throw OException.wrapException(new ODatabaseException(message), e);
    }
  }
public < RET extends Object > RET newInstance ( final String iClassName , final Object iEnclosingClass , Object ... iArgs ) { underlying . checkIfActive ( ) ; checkSecurity ( ORule . ResourceGeneric . CLASS , ORole . PERMISSION_CREATE , iClassName ) ; try { Class < ? > entityClass = entityManager . getEntityClass ( iClassName ) ; if ( entityClass != null ) { RET enhanced = ( RET ) OObjectEntityEnhancer . getInstance ( ) . getProxiedInstance ( entityManager . getEntityClass ( iClassName ) , iEnclosingClass , underlying . newInstance ( iClassName ) , null , iArgs ) ; return ( RET ) enhanced ; } else { throw new OSerializationException ( "Type " + iClassName + " cannot be serialized because is not part of registered entities. To fix this error register this class" ) ; } } catch ( Exception e ) { final String message = "Error on creating object of class " + iClassName ; OLogManager . instance ( ) . error ( this , message , e ) ; throw OException . wrapException ( new ODatabaseException ( message ) , e ) ; } }
Create a new POJO by its class name. Assure to have called the registerEntityClasses() declaring the packages that are part of
entity classes.

@see OEntityManager#registerEntityClasses(String)
Create a new POJO by its class name . Assure to have called the registerEntityClasses () declaring the packages that are part of entity classes .