1 Reply Latest reply on Feb 21, 2011 8:10 PM by kragoth

    rollback from entityHome

    sanghakanwar

      Hi,


      We have a requirement where we need to do the following operation -


      1) persist an entity
      2) call a stored procedure in db


      Both need to happen in 1 transaction which should be atomic. We are using entityHome(seam-gen).


      Issue is that if call (2) fails, then how do i do a rollback for (1) ?




      persist(){
      
      super.persist; // 1
      calldbProc(); // 2
      }




      I have tried the following options -


      1)flushmode manual ( this is not supported during create() as per the FAQs for seam)
      2)@ApplicationException ( does not work ) , changes get persisted
      3) Transaction.instance.setRollbackonly() // does not work !


      Any clue ?


      Thanks,
      Kanwar

        • 1. Re: rollback from entityHome
          kragoth

          Have you tried what is mentioned in this thread


          Obviously instead of putting the dbProc outside the commit you want it inside.


          My guess is the biggest problem is you are using the @In (Seam managed) persistenceContext so you don't have as much control over it.


          Hope it helps.