Transaction management for multiple database Using Spring & Hibernate

后端 未结 3 1959
轻奢々
轻奢々 2020-12-16 05:57

Am coming up with a Spring & Hibernate application which has Inserts/Update to its own system database and it even has to Insert/update other systems with different data

3条回答
  •  粉色の甜心
    2020-12-16 06:28

    You can specify two separate transaction managers.

        
        
        
    
    
    
        
        
    
    

    Once your set up is done you can use the qualifier to specify the transaction manager:

        public class TransactionalService {
    
    @Transactional("account")
    public void setSomethingInAccount() { ... }
    
    @Transactional("businessData")
    public void doSomethingInBusinessData() { ... }
    }
    

提交回复
热议问题