1 Reply Latest reply on Feb 24, 2009 10:28 PM by youngm

    Conversational PersistenceContext + Rollback = cleared Persistence Context

    youngm

      I'm using a conversational persistence context to manage some changes to my domain through a wizard type of UI.  I'm running into a problem with a transaction rollback in the middle of this process.


      If I'm in the last step of my wizard and my attempt to save causes a transaction rollback then it appears Hibernate clears my Persistence Context on transaction rollback and I lose all the state I've gathered through my wizard. (AbstractEntityManagerImpl:545).  Does anyone know any way around this?  It seems to me that losing all state in my conversationally scoped persistence context because of aa transaction rollback is a HUGE hole/problem with using a Conversational PersistenceContexts.  Am I using a Conversational PC wrong?  Is this a bug in Hibernate's JPA impl?  Thanks for your help.


      Mike

        • 1. Re: Conversational PersistenceContext + Rollback = cleared Persistence Context
          youngm

          Well, it's not a Hibernate bug (JPA Specification 3.3.2) specifies that when a transaction is rolled back JPA should clear it's persistence context.


          So this begs the question what is the Seam best practice in this situation?  Try to never rollback a transaction and if you do make sure you save your entity and somehow merge it back into the new persistence context?  Seems like kind of a pain.


          Mike