private function __saveAssociation(PersistentObject $object, AssociationMap $associationMap, &$commands, ClassMap $classMap)
 {
     $toAttributeMap = $associationMap->getToAttributeMap();
     $fromAttributeMap = $associationMap->getFromAttributeMap();
     if ($associationMap->getCardinality() == 'oneToOne') {
         // obtem o objeto referenciado
         $refObject = $object->get($associationMap->getName());
         if ($refObject != NULL) {
             // se a associação é inversa, atualiza o objeto referenciado
             if ($associationMap->isInverse()) {
                 $refObject->setAttributeValue($toAttributeMap, $object->getAttributeValue($fromAttributeMap));
                 $this->_saveObject($refObject, $associationMap->getToClassMap(), $commands);
             } else {
                 // se a associação é direta, atualiza o próprio objeto
                 $object->setAttributeValue($fromAttributeMap, $refObject->getAttributeValue($toAttributeMap));
                 $this->_saveObject($object, $classMap, $commands);
             }
         }
     } elseif ($associationMap->getCardinality() == 'oneToMany') {
         // atualiza os objetos referenciados
         $collection = $object->get($associationMap->getName());
         if (count($collection) > 0) {
             foreach ($collection as $refObject) {
                 if ($refObject != NULL) {
                     $refObject->setAttributeValue($toAttributeMap, $object->getAttributeValue($fromAttributeMap));
                     $this->_saveObject($refObject, $associationMap->getToClassMap(), $commands);
                 }
             }
         }
     } elseif ($associationMap->getCardinality() == 'manyToMany') {
         // atualiza a tabela associativa (removendo e reinserindo os registros de associação)
         $commands = array();
         $collection = $object->get($associationMap->getName());
         if ($object->getOIDValue()) {
             $commands[] = $associationMap->getDeleteStatement($object);
         }
         if (count($collection) > 0) {
             foreach ($collection as $refObject) {
                 if ($refObject != NULL) {
                     $commands[] = $associationMap->getInsertStatement($object, $refObject);
                 }
             }
         }
     }
 }