1 package de.spring.example;
3 import org.springframework.jdbc.datasource.DataSourceTransactionManager;
4 import org.springframework.transaction.TransactionStatus;
7 public class TransactionManagerN2A {
8 private static TransactionManagerN2A instance = new TransactionManagerN2A();
9 private DataSourceTransactionManager transactionManager;
10 private TransactionStatus transactionStatus;
12 //Why could you want to extend this class?
13 private TransactionManagerN2A() {}
15 public static TransactionManagerN2A getInstance() {
19 public void initTransaction()
21 transactionStatus = this.transactionManager.getTransaction(null);
24 public void rollbackTransaction()
26 this.transactionManager.rollback(this.transactionStatus);
29 public void commitTransaction()
31 this.transactionManager.commit(this.transactionStatus);
35 /************************* Setters and getters *******************************************/
36 public void setTransactionManager(final DataSourceTransactionManager transactionManager)
38 this.transactionManager = transactionManager;