mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-07-28 12:22:17 +08:00
Compare commits
2 Commits
9db4b43768
...
e9dd66b14f
Author | SHA1 | Date | |
---|---|---|---|
|
e9dd66b14f | ||
|
1b64d2a48c |
@ -127,7 +127,7 @@ public void testTransaction() {
|
|||||||
使用 `@Transactional`注解进行事务管理的示例代码如下:
|
使用 `@Transactional`注解进行事务管理的示例代码如下:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@Transactional(propagation=propagation.PROPAGATION_REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public void aMethod {
|
public void aMethod {
|
||||||
//do something
|
//do something
|
||||||
B b = new B();
|
B b = new B();
|
||||||
@ -277,7 +277,7 @@ public interface TransactionStatus{
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
Class A {
|
Class A {
|
||||||
@Transactional(propagation=propagation.xxx)
|
@Transactional(propagation = Propagation.xxx)
|
||||||
public void aMethod {
|
public void aMethod {
|
||||||
//do something
|
//do something
|
||||||
B b = new B();
|
B b = new B();
|
||||||
@ -286,7 +286,7 @@ Class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class B {
|
Class B {
|
||||||
@Transactional(propagation=propagation.xxx)
|
@Transactional(propagation = Propagation.xxx)
|
||||||
public void bMethod {
|
public void bMethod {
|
||||||
//do something
|
//do something
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ public enum Propagation {
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
Class A {
|
Class A {
|
||||||
@Transactional(propagation=propagation.PROPAGATION_REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public void aMethod {
|
public void aMethod {
|
||||||
//do something
|
//do something
|
||||||
B b = new B();
|
B b = new B();
|
||||||
@ -367,7 +367,7 @@ Class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class B {
|
Class B {
|
||||||
@Transactional(propagation=propagation.PROPAGATION_REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public void bMethod {
|
public void bMethod {
|
||||||
//do something
|
//do something
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ Class B {
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
Class A {
|
Class A {
|
||||||
@Transactional(propagation=propagation.PROPAGATION_REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public void aMethod {
|
public void aMethod {
|
||||||
//do something
|
//do something
|
||||||
B b = new B();
|
B b = new B();
|
||||||
@ -391,7 +391,7 @@ Class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class B {
|
Class B {
|
||||||
@Transactional(propagation=propagation.REQUIRES_NEW)
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
public void bMethod {
|
public void bMethod {
|
||||||
//do something
|
//do something
|
||||||
}
|
}
|
||||||
@ -409,7 +409,7 @@ Class B {
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
Class A {
|
Class A {
|
||||||
@Transactional(propagation=propagation.PROPAGATION_REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public void aMethod {
|
public void aMethod {
|
||||||
//do something
|
//do something
|
||||||
B b = new B();
|
B b = new B();
|
||||||
@ -418,7 +418,7 @@ Class A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Class B {
|
Class B {
|
||||||
@Transactional(propagation=propagation.PROPAGATION_NESTED)
|
@Transactional(propagation = Propagation.NESTED)
|
||||||
public void bMethod {
|
public void bMethod {
|
||||||
//do something
|
//do something
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user