Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tomcat 7 - Setting UnitOfWork Properties to be used across DAOs

9967e232-2bf5-4dff-a451-206e772b9348Sep 9 2016 — edited Sep 9 2016

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 { 

    impl.setUnitOfWork(details); 

    daoA.saveA(dto.getEntityADetails()) 

    daoB.saveB(dto.getEntityBDetails()); 

 

pubcli 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; 

                    } 

           }); 

     } 

I understand that the setProperty() of uow is inherited from the session.

How can I make sure that all the uow's I access in the callback share the same session in Tomcat with Spring? I am having the session instance as FinalizedClientSession when i listen to the uow.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2016
Added on Sep 9 2016
0 comments
373 views