vendredi 31 juillet 2020

How handle transaction in Chain Of Responsibility pattern?

I have a transaction issue on COR pattern:

       AbstractChainHandler
      |                   |
      |                   |
   FirstChainHandler     SecondChainHandler
    -create A               -create B
    -delete A               -delete B

FirstChainHandler and SecondChainHandler both extend AbstractChainHandler and they do some persistence tasks. Is it possible to handle transaction so if SecondChainHandler fails to save A on db also FirstChainHandler does the rollback of B persistence?

I am trying with spring @Transactional but it is not working and I am not sure if COR pattern matches my goal. I tryied to change propagation and isolation configurations but I didn't work.

Aucun commentaire:

Enregistrer un commentaire