Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.DatastoreService.beginTransaction()


      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);

      beginTxn();
      HasOneToOneJDO pojo = pm.getObjectById(HasOneToOneJDO.class, KeyFactory.keyToString(pojoEntity.getKey()));
View Full Code Here


    private static final Key _SERVICE_STATUS_KEY =
        KeyFactory.createKey("ServiceStatus", "1");

    public static Entity getStatusEntity() {
        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        Transaction txn = datastore.beginTransaction();
        Entity status;
        try {
            status = datastore.get(txn, _SERVICE_STATUS_KEY);
        } catch (EntityNotFoundException e) {
            status = new Entity(_SERVICE_STATUS_KEY);
View Full Code Here

    // Get or create a user entity for a JID.  This truncates the
    // resource portion of the JID, so multiple user clients are
    // consolidated into one record per account.
    public static Entity getUserEntity(JID jid) {
        DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
        Transaction txn = datastore.beginTransaction();
        String jidStr = jid.getId();
        if (jidStr.indexOf("/") != -1) {
            jidStr = jidStr.substring(0, jidStr.indexOf("/"));
        }
        Key userKey = KeyFactory.createKey("ChatUser", jidStr);
View Full Code Here

        int retries = 3;
        boolean success = false;
        while (!success && retries > 0) {
            --retries;
            try {
                Transaction txn = ds.beginTransaction();

                Key boardKey;
                Entity messageBoard;
                try {
                    boardKey = KeyFactory.createKey("MessageBoard", boardName);
View Full Code Here

    // Weirdly, this will solve the problem too
    //MemcacheService cs = MemcacheServiceFactory.getMemcacheService();
    //cs.clearAll();

    Transaction txn = cacheds.beginTransaction();
    Entity ent2;
    try {
      ent2 = ds.get(txn, childKey);
      //ent2 = new Entity(childKey);  // solves the problem
      ent2.setProperty("foo", "changed");
View Full Code Here

    cs1.put(childKey, ent);

    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    ds.put(ent);

    Transaction txn = ds.beginTransaction();
    try {
      Entity ent2 = ds.get(txn, childKey);
 
      //Entity ent2 = (Entity)cs1.get(childKey);
      assert ent2.getProperty("foo").equals("original");
View Full Code Here

            String entity = work.getEntityClass().toString();
            LOG.info("Performing lucene work for " + entity);
            time = System.currentTimeMillis();
          }

          Transaction transaction = datastoreService.beginTransaction();
          try {
            work.getWorkDelegate(getVisitor()).performWork(work, indexWriter, monitor);
            transaction.commit();
          } finally {
            if (transaction.isActive())
View Full Code Here

    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
   
     
     
     
      Transaction txn = datastore.beginTransaction();
     
      Entity function1= new Entity("memberDetail");
     
      function1.setProperty("mem_id", "Create Member");
     
View Full Code Here

      //datastore.put(function5);
      txn.commit();
    /*Transaction txn2 = datastore.beginTransaction();datastore.put(function4);txn2.commit();
    Transaction txn3 = datastore.beginTransaction();datastore.put(function3);txn3.commit();
      Transaction txn4 = datastore.beginTransaction();datastore.put(function2);txn4.commit();*/
      Transaction txn5 = datastore.beginTransaction();datastore.put(function1);txn5.commit();
      //Transaction txn6 = datastore.beginTransaction();datastore.put(function6);txn6.commit();
     
      //txn.commit();
     
     
View Full Code Here

    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
   
   
   
   
    Transaction txn = datastore.beginTransaction();
   
    Entity function2= new Entity("CaeDetail");
   
    function2.setProperty("car_id", Id);
   
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.