Transaction rollback behavior

Showing 1-2 of 2 messages
Transaction rollback behavior Kyle 6/16/09 7:59 AM
Maybe I'm missing something, but I'm unable to rollback a transaction
that *inserts* a record. I have the following code:

Transaction tx = pm.currentTransaction();
try {
    Counter counter;
    try {
                counter = (Counter)pm.getObjectById(Counter.class, key);
        } catch(JDOObjectNotFoundException e) {
                counter = new Counter(key);
        counter.setValue(counter.getValue() + amount);
} finally {

If I pass in an existing key, everything works as expected, rolling
back to the original value. However, when I pass in a new key (causing
a new Counter to be created), the rollback doesn't seem to affect the
new key (it's inserted regardless, and remains even after the
rollback). I assumed that rolling back the transaction would revert
the insertion. Anyone able to shed some light on this behavior?

Re: [appengine-java] Transaction rollback behavior jrray 6/16/09 5:53 PM
If you're trying this in the development environment, be advised that
the development environment does not support transactions.

Your new Counter entity is saved to the datastore as soon as
makePersistent runs, and rollback is a no-op.