Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Transaction.commit()


      try {
        entity.setProperty("names", localNames);
       
        datastoreService.put(txn, entity);
       
        txn.commit();

        return ResultType.ADD_SUCCESS;
      } catch (Exception e) {
        _logger.warning("Failure to save entity with names: " + e);
        if (localNames.size() >= 5000) { //python has an error about size, but we'll just artificially limit it to 1000 here
View Full Code Here


    //logger.info("Grabando entidad");
    Transaction txn = null;
    try {
      txn = datastore.beginTransaction();
      datastore.put(entity);
      txn.commit();
    } catch (IllegalArgumentException e) {
      logger.fatal(e.getMessage());
    } catch (ConcurrentModificationException e) {
      logger.fatal(e.getMessage());
    } catch (DatastoreFailureException e) {
View Full Code Here

    //logger.info("Grabando entidad");
    Transaction txn = null;
    try {
      txn = datastore.beginTransaction();
      datastore.delete(key);
      txn.commit();
    } catch (IllegalArgumentException e) {
      logger.fatal(e.getMessage());
    } catch (ConcurrentModificationException e) {
      logger.fatal(e.getMessage());
    } catch (DatastoreFailureException e) {
View Full Code Here

    //logger.info("Grabando entidad");
    Transaction txn = null;
    try {
      txn = datastore.beginTransaction();
      datastore.delete(keys);
      txn.commit();
    } catch (IllegalArgumentException e) {
      logger.fatal(e.getMessage());
    } catch (ConcurrentModificationException e) {
      logger.fatal(e.getMessage());
    } catch (DatastoreFailureException e) {
View Full Code Here

      DATASTORE.delete(tx, key);
    } catch (EntityNotFoundException ex) {
      return false;
    } finally {
      if (tx.isActive()) {
        tx.commit();
      }
    }
    FILES.delete(nameToAppEngineFile(filename));
    return true;
  }
View Full Code Here

      bidirEntity.setProperty("childVal", "yap");
      ds.put(bidirEntity);

      Transaction txn = EasyMock.createMock(Transaction.class);
      EasyMock.expect(txn.getId()).andReturn("1").times(2);
      txn.commit();
      EasyMock.expectLastCall();
      EasyMock.replay(txn);
      EasyMock.expect(mockDatastore.beginTransaction(EasyMock.isA(TransactionOptions.class))).andReturn(txn);
      // the only get we're going to perform is for the pojo
      EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
View Full Code Here

      ds.put(hasParentKeyPkEntity);

      // the only get we're going to perform is for the pojo
      txn = EasyMock.createMock(Transaction.class);
      EasyMock.expect(txn.getId()).andReturn("1").times(2);
      txn.commit();
      EasyMock.expectLastCall();
      EasyMock.replay(txn);
      EasyMock.expect(mockDatastore.beginTransaction(EasyMock.isA(TransactionOptions.class))).andReturn(txn);
      EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
      EasyMock.replay(mockDatastore);
View Full Code Here

    // overwrite band1
    Band band3 = new Band();
    band3.name = "Kasier Chiefs";
    datastore.store().instance(band3);
    txn.commit();

    txn = datastore.beginTransaction();
    Band band4 = new Band();
    band4.name = "Kasier Chiefs";
View Full Code Here

      hasParentKeyPkEntity.setProperty("str", "yag");
      ds.put(hasParentKeyPkEntity);

      Transaction txn = EasyMock.createMock(Transaction.class);
      EasyMock.expect(txn.getId()).andReturn("1").times(2);
      txn.commit();
      EasyMock.expectLastCall();
      EasyMock.replay(txn);
      EasyMock.expect(mockDatastore.beginTransaction(EasyMock.isA(TransactionOptions.class))).andReturn(txn);
      // the only get we're going to perform is for the pojo
      EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
View Full Code Here

      bidirEntity.setProperty("childVal", "yap");
      ds.put(bidirEntity);

      Transaction txn = EasyMock.createMock(Transaction.class);
      EasyMock.expect(txn.getId()).andReturn("1").times(2);
      txn.commit();
      EasyMock.expectLastCall();
      EasyMock.replay(txn);
      EasyMock.expect(mockDatastore.beginTransaction(EasyMock.isA(TransactionOptions.class))).andReturn(txn);
      // the only get we're going to perform is for the pojo
      EasyMock.expect(mockDatastore.get(txn, pojoEntity.getKey())).andReturn(pojoEntity);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.