title: Nested transactions on google app engine datastore 3
body: <p>Question is: does ds.put(employee) happen in transaction? Or does the outer transaction get erased/overriden by the transaction in saveRecord(..)? </p>
  
  <ol>
  <li>Once error is thrown at line datastore.put(..) at some point in the for-loop (let's say i==5), will previous puts originating on the same line get rollbacked?</li>
  <li>What about puts happening in the saveRecord(..). I suppose those will not get rollbacked.</li>
  </ol>
  
  <pre>
  
      DatastoreService datastore = DatastoreServiceFactory.getDatastoreService()
      Transaction txn = datastore.beginTransaction();
      try {
          for (int i=0; 1&lt;10; i++) {
              Key employeeKey = KeyFactory.createKey("Employee", "Joe");
              Entity employee = datastore.get(employeeKey);
              employee.setProperty("vacationDays", 10);
  
              datastore.put(employee);
  
              Entity employeeRecord = createRecord("record", employeeKey);
              saveRecord(employeeRecord);
          }
      txn.commit();
      } finally {
          if (txn.isActive()) {
              txn.rollback();
          }
      }
  
      public void saveRecord(Entity entity) {
         datastore.beginTransaction();
         try {
            // do some logic in here, delete activity and commit txn
            datastore.put(entity);
         } finally {
          if (datastore.getCurrentTransaction().isActive()) {
            datastore.getCurrentTransaction().rollback();
          }
         }
      }
  
  </pre>