Transactions

We can use explicit transactions to wrap multiple database actions such as queries or persisting via save() etc.

try (Transaction transaction = ebeanServer.beginTransaction()) {

  // do stuff...
  Customer customer = ...
  customer.save();

  Order order = ...
  order.save();

  transaction.commit();
}

We can alternatively use Ebean's @Transactional annotation on methods or Spring Transactions or JTA Transactions.

@Transactional
public void process(OffsetDateTime startOffset) {
  ...
}

Edit Page