1 Reply Latest reply on Nov 25, 2008 3:35 PM by odospamkill

    Database Exception kills Extended Conversation

    odospamkill
      I want to catch and handle the OptimisticLockException returned by Hibernate when I flush a transaction.  This is being done within an extended conversation managed through a jpdl pageflow.  On this exception, I try to
        - explicitly rollback the DB transaction,
        - clear() the Persistence context
        - begin a new DB transaction in the same Persistence context
        - reload the entities

         However, Seam kills the extended conversation, ie, closes the Hibernate EntityManager/Session/Persitence context at the end of the Request.  Is there any way I can coax Seam to leave the conversation intact?
      If OptimisticLockException had been an applicationexception, I suppose I could have annotated it with @ApplicationException(end=false) ?
      My Seam version is 2.1.0
      Thanks for any tips or help
        • 1. Re: Database Exception kills Extended Conversation
          odospamkill

          What I stated above is not accurate.  Towards the end of the Request, Seam or Hibernate closes the Hibernate EntityManager/Session.  As a result, a Lazy Init Exception is thrown when Seam attempts to build the response page.  So what I really need to do is somehow get Seam to create a new instance of the EntityManager.