Search code examples
javagoogle-app-engineobjectify

If my datastore transaction fails, will code after the transaction run?


What happens if my datastore transaction fails and I have some more code that is supposed to run after it finishes? Does the application throw and error and end there? Will my second block of code run or will it never be reached?

ofy().transact(new Runnable() {
    @Override
    public void run() {
        // Some code here.
    }
});

// Some more datastore code here. Will this be reached if the transact fails?

Solution

  • If the transaction fails you will get an exception. If you don't handle the exception it will propagate.