Transactions in Ebean

begin, commit, rollback end

This is the more traditional approach for demarcating transactions via a try finally block.

try {
        // fetch some stuff...
        User u = Ebean.find(User.class, 1);

        // save or delete stuff...;

} finally {

The code above will generally use a ThreadLocal to hold the Transaction to begin, commit and end the transaction (end will perform a rollback if required).


Ebean.endTransaction() will check to see if the transaction has already commited, if so then it does nothing, otherwise it will rollback the transaction. It is typically always in the finally.

Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements