Property transactions
1 propagation is used to set the transaction propagation behavior
The propagation of transaction: One way to run a method to open the transaction, the current approach is to use the attachment method affairs or the use of its own affairs
Propagation.REQUIRED default value other people's affairs method of attachment
Propagation.REQUIRES_NEW the original transaction hangs open a new transaction (that is, the implementation of its own affairs)
Use on the method requires the use of a transaction annotated @Transactional nothing Jia Mo think Propagation.REQUIRED
To open a new transaction to perform their own affairs in the way you can add @Transactional (propagation = Propagation.REQUIRES_NEW)
2 isolation is used to set the transaction isolation level
Oracle supports transaction isolation level (Read Committed read committed by default serialized serializable
- Mysql support all transaction isolation level read uncommitted read uncommitted
- Read Committed read commited
- (Default) repeatable read repeatable read
- Serialized serializable
With the spread of behavior is the same as in the notes @Transaction () add (isolation = Isolation.DEFAULT)
Example: buy books Mysql database default before the repeatable read transaction isolation level the database when the price of the book becomes isolated on the price still fluctuates