transactions
An important aspect of enterprise applications is the definition of the transaction boundaries:
- Transactions are used to guarantees data integrity
- The locking implied by some transaction modes can have a noticeable impact on performance
- Transactions can be complex to setup
The framework provides the following features and optimizations:
- By default, all objects (and nested objects) are use transactions transparently.
- The transaction isolation can be set per object using a simple annotation
(or using properties files, etc - see configuration for more information).
The annotation is called Transaction.java
and the possible values are defined in the enumeration
TransactionMode.java.
It supports all the transaction isolations defined in JDBC 4.0 and also an ASYNCHRONOUS
mode, which
delegates the write process to a separate thread for high performance (but without guanrantees that the object has been saved
when the method call returns to its caller).
- It allows nested objects to be saved in the same transaction and supports cascading operations.
See the Cascade annotation for more information.
- It minimizes the amount of time during which the store's lock is held by preparing most of the work outside the transaction
and only holding the lock to execute the statements it needs to run.
For more detailed information about how transaction are processed, see transactions code flow.