public <RET> RET save(final Object iPojo, final String iClusterName, OPERATION_MODE iMode, boolean iForceCreate,
      final ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) {
    checkOpenness();
    if (iPojo == null)
      return (RET) iPojo;
    else if (OMultiValue.isMultiValue(iPojo)) {
      // MULTI VALUE OBJECT: STORE SINGLE POJOS
      for (Object pojo : OMultiValue.getMultiValueIterable(iPojo)) {
        save(pojo, iClusterName);
      }
      return (RET) iPojo;
    } else {
      OSerializationThreadLocal.INSTANCE.get().clear();

      // GET THE ASSOCIATED DOCUMENT
      final Object proxiedObject = OObjectEntitySerializer.serializeObject(iPojo, this);
      final ODocument record = getRecordByUserObject(proxiedObject, true);
      try {
        record.setInternalStatus(ORecordElement.STATUS.MARSHALLING);

        if (!saveOnlyDirty || record.isDirty()) {
          // REGISTER BEFORE TO SERIALIZE TO AVOID PROBLEMS WITH CIRCULAR DEPENDENCY
          // registerUserObject(iPojo, record);
          deleteOrphans((((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler())));

          ODocument savedRecord = underlying
              .save(record, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback);

          ((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler()).setDoc(savedRecord);
          ((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler()).updateLoadedFieldMap(proxiedObject, false);
          // RE-REGISTER FOR NEW RECORDS SINCE THE ID HAS CHANGED
          registerUserObject(proxiedObject, record);
        }
      } finally {
        record.setInternalStatus(ORecordElement.STATUS.LOADED);
      }
      return (RET) proxiedObject;
    }
  }
public <RET> RET save(final Object iPojo, final String iClusterName, OPERATION_MODE iMode, boolean iForceCreate,
      final ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) {
    checkOpenness();
    if (iPojo == null)
      return (RET) iPojo;
    else if (OMultiValue.isMultiValue(iPojo)) {
      
      for (Object pojo : OMultiValue.getMultiValueIterable(iPojo)) {
        save(pojo, iClusterName);
      }
      return (RET) iPojo;
    } else {
      OSerializationThreadLocal.INSTANCE.get().clear();

      
      final Object proxiedObject = OObjectEntitySerializer.serializeObject(iPojo, this);
      final ODocument record = getRecordByUserObject(proxiedObject, true);
      try {
        record.setInternalStatus(ORecordElement.STATUS.MARSHALLING);

        if (!saveOnlyDirty || record.isDirty()) {
          
          
          deleteOrphans((((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler())));

          ODocument savedRecord = underlying
              .save(record, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback);

          ((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler()).setDoc(savedRecord);
          ((OObjectProxyMethodHandler) ((ProxyObject) proxiedObject).getHandler()).updateLoadedFieldMap(proxiedObject, false);
          
          registerUserObject(proxiedObject, record);
        }
      } finally {
        record.setInternalStatus(ORecordElement.STATUS.LOADED);
      }
      return (RET) proxiedObject;
    }
  }
public < RET > RET save ( final Object iPojo , final String iClusterName , OPERATION_MODE iMode , boolean iForceCreate , final ORecordCallback < ? extends Number > iRecordCreatedCallback , ORecordCallback < Integer > iRecordUpdatedCallback ) { checkOpenness ( ) ; if ( iPojo == null ) return ( RET ) iPojo ; else if ( OMultiValue . isMultiValue ( iPojo ) ) { // MULTI VALUE OBJECT: STORE SINGLE POJOS
 for ( Object pojo : OMultiValue . getMultiValueIterable ( iPojo ) ) { save ( pojo , iClusterName ) ; } return ( RET ) iPojo ; } else { OSerializationThreadLocal . INSTANCE . get ( ) . clear ( ) ; // GET THE ASSOCIATED DOCUMENT
 final Object proxiedObject = OObjectEntitySerializer . serializeObject ( iPojo , this ) ; final ODocument record = getRecordByUserObject ( proxiedObject , true ) ; try { record . setInternalStatus ( ORecordElement . STATUS . MARSHALLING ) ; if ( ! saveOnlyDirty || record . isDirty ( ) ) { // REGISTER BEFORE TO SERIALIZE TO AVOID PROBLEMS WITH CIRCULAR DEPENDENCY
 // registerUserObject(iPojo, record);
 deleteOrphans ( ( ( ( OObjectProxyMethodHandler ) ( ( ProxyObject ) proxiedObject ) . getHandler ( ) ) ) ) ; ODocument savedRecord = underlying . save ( record , iClusterName , iMode , iForceCreate , iRecordCreatedCallback , iRecordUpdatedCallback ) ; ( ( OObjectProxyMethodHandler ) ( ( ProxyObject ) proxiedObject ) . getHandler ( ) ) . setDoc ( savedRecord ) ; ( ( OObjectProxyMethodHandler ) ( ( ProxyObject ) proxiedObject ) . getHandler ( ) ) . updateLoadedFieldMap ( proxiedObject , false ) ; // RE-REGISTER FOR NEW RECORDS SINCE THE ID HAS CHANGED
 registerUserObject ( proxiedObject , record ) ; } } finally { record . setInternalStatus ( ORecordElement . STATUS . LOADED ) ; } return ( RET ) proxiedObject ; } }
Saves an object to the database forcing a record cluster where to store it. First checks if the object is new or not. In case
it's new a new ODocument is created and bound to the object, otherwise the ODocument is retrieved and updated. The object is
introspected using the Java Reflection to extract the field values. <br> If a multi value (array, collection or map of objects)
is passed, then each single object is stored separately.
<p>
Before to use the specified cluster a check is made to know if is allowed and figures in the configured and the record is valid
following the constraints declared in the schema.

@see ODocument#validate()
Saves an object to the database forcing a record cluster where to store it . First checks if the object is new or not . In case it s new a new ODocument is created and bound to the object otherwise the ODocument is retrieved and updated . The object is introspected using the Java Reflection to extract the field values . <br > If a multi value ( array collection or map of objects ) is passed then each single object is stored separately . <p > Before to use the specified cluster a check is made to know if is allowed and figures in the configured and the record is valid following the constraints declared in the schema .