2014-09-04 26 views

回答

1

这应该很好地工作:

try { 
     datastore.getTransactionManager().startTransaction(); 
     datastore.getTransactionManager().removeWhere("storeName", BaseConditions.Equal("attribute", value)); 
     datastore.getTransactionManager().commitTransaction(); 
    } catch (DatastoreTransactionException e) { 
     try { 
      datastore.getTransactionManager().rollbackTransaction(); 
     } catch (DatastoreTransactionException re) { 
      throw new QuartetRuntimeException("The transaction rollback has failed.", re); 
     } 
     throw new QuartetRuntimeException("The transaction commit has failed.", e); 
    }