Package com.google.appengine.api.datastore

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


            DatastoreUtil.put(ds, tx, toEntity());
            tx.commit();
            return map;
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
    }

    /**
 
View Full Code Here


            tx.commit();
        } catch (ConcurrentModificationException e) {
            throw createConcurrentModificationException(rootKey, e);
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
    }

    /**
 
View Full Code Here

            } catch (ConcurrentModificationException ignore) {
                return false;
            }
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
    }

    /**
 
View Full Code Here

     */
    @Test(expected = IllegalStateException.class)
    public void setIllegalTx() throws Exception {
        MyQuery q = new MyQuery(ds, "Hoge");
        Transaction tx = DatastoreUtil.beginTransaction(ds);
        tx.rollback();
        q.setTx(tx);
    }

    /**
     * @throws Exception
View Full Code Here

                DatastoreUtil.delete(ds, tx, key);
                tx.commit();
            }
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
    }

    /**
 
View Full Code Here

    @Test(expected = IllegalStateException.class)
    public void getAsMapAsyncTxIsIllegal() throws Exception {
        Key key = ds.put(new Entity("Hoge")).get();
        Key key2 = ds.put(new Entity("Hoge", key)).get();
        Transaction tx = ds.beginTransaction().get();
        tx.rollback();
        DatastoreUtil.getAsMapAsync(ds, tx, Arrays.asList(key, key2));
    }

    /**
     * @throws Exception
View Full Code Here

        Transaction tx = ds.beginTransaction().get();
        List<Key> keys =
            DatastoreUtil
                .putAsync(ds, tx, Arrays.asList(entity, entity2))
                .get();
        tx.rollback();
        assertThat(keys, is(notNullValue()));
        assertThat(keys.size(), is(2));
        assertThat(tester.count("Hoge"), is(0));
    }
View Full Code Here

    public void putAsyncIllegalTx() throws Exception {
        Entity entity = new Entity(KeyFactory.createKey("Hoge", 1));
        Entity entity2 =
            new Entity(KeyFactory.createKey(entity.getKey(), "Hoge", 1));
        Transaction tx = ds.beginTransaction().get();
        tx.rollback();
        DatastoreUtil.putAsync(ds, tx, Arrays.asList(entity, entity2)).get();
    }

    /**
     * @throws Exception
View Full Code Here

    @Test
    public void deleteAsync() throws Exception {
        Key key = ds.put(new Entity("Hoge")).get();
        Transaction tx = ds.beginTransaction().get();
        DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
        tx.rollback();
        assertThat(tester.count("Hoge"), is(1));
    }

    /**
     * @throws Exception
View Full Code Here

     */
    @Test(expected = IllegalStateException.class)
    public void deleteAsyncIllegalTx() throws Exception {
        Key key = ds.put(new Entity("Hoge")).get();
        Transaction tx = ds.beginTransaction().get();
        tx.rollback();
        DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
    }

    /**
     * @throws Exception
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.