Spring transactions

The recommendation is to use Ebean's own transaction management but we can also use spring transactions.

To do so include the dependency:

<dependency>
  <groupId>io.ebean</groupId>
  <artifactId>ebean-spring-txn</artifactId>
  <version>13.0.0</version>
</dependency>

Set SpringJdbcTransactionManager as an external transaction by:

DatabaseConfig config = new DatabaseConfig();

config.setExternalTransactionManager(new SpringJdbcTransactionManager());