0
# JTA Integration
1
2
Spring's JTA integration provides support for distributed transaction management in enterprise environments.
3
4
## JtaTransactionManager
5
6
```java { .api }
7
public class JtaTransactionManager extends AbstractPlatformTransactionManager {
8
public JtaTransactionManager();
9
public JtaTransactionManager(UserTransaction userTransaction);
10
public JtaTransactionManager(UserTransaction userTransaction, TransactionManager transactionManager);
11
12
public void setUserTransaction(UserTransaction userTransaction);
13
public UserTransaction getUserTransaction();
14
public void setTransactionManager(TransactionManager transactionManager);
15
public TransactionManager getTransactionManager();
16
17
public void setAllowCustomIsolationLevels(boolean allowCustomIsolationLevels);
18
public void setGlobalRollbackOnParticipationFailure(boolean globalRollbackOnParticipationFailure);
19
}
20
```
21
22
## TransactionFactory
23
24
```java { .api }
25
public interface TransactionFactory {
26
Transaction createTransaction(@Nullable String name, int timeout)
27
throws NotSupportedException, SystemException;
28
}
29
```
30
31
## Usage Examples
32
33
```java
34
@Configuration
35
public class JtaConfig {
36
37
@Bean
38
public PlatformTransactionManager transactionManager() {
39
JtaTransactionManager tm = new JtaTransactionManager();
40
tm.setUserTransaction(userTransaction());
41
tm.setTransactionManager(jtaTransactionManager());
42
return tm;
43
}
44
45
@Bean
46
public UserTransaction userTransaction() {
47
// Configure UserTransaction
48
return new UserTransactionAdapter(jtaTransactionManager());
49
}
50
}
51
```