Setting the Propagation Attribute in Transaction Advices, Proxies, and APIs
In a Spring transaction advice, the propagation transaction attribute can be specified in the <tx:method>
element as follows:
<tx:method name= " ... "
propagation= " REQUIRES_NEW " />
In classic Spring AOP, the propagation transaction attribute can be specified in the transaction
attributes of TransactionInterceptor and TransactionProxyFactoryBean as follows:
<property name= " transactionAttributes " >
<prop key= " ... " >PROPAGATION_REQUIRES_NEW</prop>
In Spring's transaction management API, the propagation transaction attribute can be specified in
a DefaultTransactionDefinition object and then passed to a transaction manager's getTransaction()
method or a transaction template's constructor.
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
4-8. Setting the Isolation Transaction Attribute
When multiple transactions of the same application or different applications are operating concurrently
on the same dataset, many unexpected problems may arise. You must specify how you expect your
transactions to be isolated from one another.
The problems caused by concurrent transactions can be categorized into four types:
Dirty read : For two transactions T1 and T2, T1 reads a field that has been updated by T2 but not yet
committed. Later, if T2 rolls back, the field read by T1 will be temporary and invalid.
Non-repeatable read : For two transactions T1 and T2, T1 reads a field and then T2 updates the field.
Later, if T1 reads the same field again, the value will be different.