The spring transaction annotations default encounters the throw new RuntimeException ("..."); the throw new Exception ("...") that needs to be captured will be rolled back; not rolled back
//Specify Rollback@Transactional (rollbackfor=exception.class) Public voidMethodName () {//does not roll back Throw NewException ("..."); } //specify not to roll back@Transactional (norollbackfor=exception.class) PublicItimdaoimpl Getitemdaoimpl () {//will roll back Throw NewRuntimeException ("Note"); } //If there is a transaction, then join the transaction, and then create a new one (without writing the case) .@Transactional (propagation=propagation.required)//container does not open transactions for this method@Transactional (propagation=propagation.not_supported)//creates a new transaction regardless of whether a transaction exists, the original hangs, the new execution completes, and the old transaction continues@Transactional (propagation=propagation.requires_new)//must be executed in an existing transaction, or throw an exception@Transactional (propagation=propagation.mandatory)//must be executed in a non-transaction, otherwise throws an exception (as opposed to propagation.mandatory)@Transactional (propagation=propagation.never)//If the other bean calls this method and declares the transaction in another bean, the transaction is used. If the other bean does not declare the transaction, then there is no transaction.@Transactional (propagation=propagation.supports)/*Public void MethodName () {//Modify Method 1 of this class update (); Call the modification method of the other class otherbean.update (); Modification method of this Class 2 update (); } Other failure does not affect this class of modification submitted successfully this type of update failure, other also failed*/@Transactional (Propagation=propagation.nested)//Readonly=true read-only, can be inserted, but cannot be updated, deleted@Transactional (propagation = propagation.required,readonly=true) //setting the time-out period@Transactional (propagation = propagation.required,timeout=30)//Setting the database isolation level@Transactional (propagation = Propagation.required,isolation=isolation.default)
@Transactionl annotations