Documentation / Transactions / @Transactional
@Transactional
We can put @Transactional
annotation on methods (including private methods) and Ebean
enhancement will add transaction demarcation to those methods.
@Transactional
public void process(OffsetDateTime startOffset) {
...
}
ebean.mf
For the @Transactional
to work we need to make sure the ebean.mf
manifest
file specifies the packages that contain the classes annotated with @Transactional such that they are enhanced.
The ebean.mf file is typically located in src/main/resources/ebean.mf
.
Example ebean.mf
entity-packages: org.example.domain
transactional-packages: org.example
querybean-packages: none
With the example above we are enhancing @Transactional
methods for classes in org.example
and any sub-packages.
Reference: docs/configuration/manifest
Note that the CLI Command line tool can generate the ebean.mf file so look to use that if you like.