Package com.google.appengine.api.datastore

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


        Transaction tx = Datastore.beginTransaction();
        List<Key> keys = new ArrayList<Key>();
        keys.add(key);
        keys.addAll(Datastore.query(f, key).asKeyList());
        Datastore.delete(tx, keys);
        tx.commit();
    }
}
View Full Code Here


    }

    public void insert(Blog blog) {
        Transaction tx = Datastore.beginTransaction();
        Datastore.put(tx, blog);
        tx.commit();
    }

    public Blog update(Key key, Long version, Map<String, Object> input) {
        Transaction tx = Datastore.beginTransaction();
        Blog blog = Datastore.get(tx, b, key, version);
View Full Code Here

    public Blog update(Key key, Long version, Map<String, Object> input) {
        Transaction tx = Datastore.beginTransaction();
        Blog blog = Datastore.get(tx, b, key, version);
        BeanUtil.copy(input, blog);
        Datastore.put(tx, blog);
        tx.commit();
        return blog;
    }

    public void delete(Key key, Long version) {
        Transaction tx = Datastore.beginTransaction();
View Full Code Here

    public void delete(Key key, Long version) {
        Transaction tx = Datastore.beginTransaction();
        Blog blog = Datastore.get(tx, b, key, version);
        Datastore.delete(tx, blog.getKey());
        tx.commit();
    }
}
View Full Code Here

            Entity entity = DatastoreUtil.getOrNull(ds, tx, key);
            if (entity != null
                && globalTransactionKey.equals(entity
                    .getProperty(GLOBAL_TRANSACTION_KEY_PROPERTY))) {
                DatastoreUtil.delete(ds, tx, key);
                tx.commit();
            }
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
View Full Code Here

        try {
            Lock lock = getOrNull(ds, tx, key);
            if (lock != null
                && globalTransactionKey.equals(lock.globalTransactionKey)) {
                DatastoreUtil.delete(ds, tx, key);
                tx.commit();
            }
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
View Full Code Here

            Lock other = getOrNull(ds, tx, key);
            if (other != null) {
                verify(other);
            }
            DatastoreUtil.put(ds, tx, toEntity());
            tx.commit();
            return;
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
View Full Code Here

            if (otherEntity != null) {
                Lock other = toLock(ds, otherEntity);
                verify(other);
            }
            DatastoreUtil.put(ds, tx, toEntity());
            tx.commit();
            return map;
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
View Full Code Here

                }
                return;
            }
            gtx = new GlobalTransaction(ds, other.globalTransactionKey, false);
            GlobalTransaction.put(ds, tx, gtx);
            tx.commit();
        } catch (ConcurrentModificationException e) {
            throw createConcurrentModificationException(rootKey, e);
        } finally {
            if (tx.isActive()) {
                tx.rollback();
View Full Code Here

            KeyFactory.createKey(GlobalTransaction.KIND, 1);
        Boolean valid = false;
        GlobalTransaction gtx2 =
            new GlobalTransaction(ds, globalTransactionKey, valid);
        GlobalTransaction.put(ds, tx, gtx2);
        tx.commit();
        Entity entity = DatastoreUtil.get(ds, null, globalTransactionKey);
        assertThat(entity, is(notNullValue()));
        assertThat((Boolean) entity
            .getProperty(GlobalTransaction.VALID_PROPERTY), is(valid));
    }
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.