0

In Spring, is there a way I can access the properties of the unitofwork across the DAO's?

Let's assume I have a service layer:

public Class A {      
    public doSave (){  
        impl.setUnitOfWork(details);  
        daoA.saveA(dto.getEntityADetails())  
        daoB.saveB(dto.getEntityBDetails());  
    }
}  

public class Impl extends TopLinkDaoSupport {  

    public void setUnitOfWork (TxnDetailsDTO details) {  
        getSection().getTopLinkTemplate().execute (new UnitOfWorkCallback() {  
            protected object doInUnitOfWork (UnitofWork uow) {  
                uow.setProperty ('prop1', details);  
                return null;  
            }  
         });  
     }  
}  

public Class DAOA {  

    public saveA (DTO dto) {  
        getSection().getTopLinkTemplate().execute (new UnitOfWorkCallback() {  
            protected object doInUnitOfWork (UnitofWork uow) {  
                if (uow.getProperty('prop1'))  
                    uow.registerObject(dto);  
                return null;  
            }  
        });  
    }  
}  


public Class DAOB {  

    public saveB (DTO dto) {  
        getSection().getTopLinkTemplate().execute (new UnitOfWorkCallback() {  
            protected object doInUnitOfWork (UnitofWork uow) {  
                if (uow.getProperty('prop1'))  
                    uow.registerObject(dto);  
                return null;  
            }  
        });  
    }  
}   

Server is Tomcat.

I have a similar implementation done with WebSphere & that works, but with Tomcat I am not able to access it.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
Ravi raj
  • 136
  • 1
  • 1
  • 7

0 Answers0