3 Replies Latest reply on Dec 6, 2007 3:56 PM by whafrog

    @End commits entity changes!

    whafrog

      How do I end the conversation without letting hibernate commit the entity changes? Editing is a two stage process: edit, then verify. If I call my action's quit method from the edit page (with immediate="true" on the button), all is fine. If I go to the verify page and make the same call to the quit method, the entities are updated anyway.

      Button:

      <h:commandButton type="submit" value="Quit without Saving" action="#{myaction.quit}" immediate="true"/>


      Method:
      @End
       @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
       public String quit()
       {
       logger.debug("Quitting without saving");
       return PAGE_MAIN;
       }
      


      If I don't use the @End annotation, nothing is persisted, but then the conversation is out there in memory. Any advice?

      Thanks,

      Jon


        • 1. Re: @End commits entity changes!
          gsegura

          I think this is related to the flush mode of the conversation, look for @Begin(flushMode=FlushModeType.MANUAL),
          I think that normally when conversation ends everything is flushed autommatically.

          I just posted a somewhat related question but there the conversation is not finished and yet I'm having an update, ok, no more crossposting :P

          • 2. Re: @End commits entity changes!
            whafrog

            A call to "entityManager.clear()" seems to solve the problem. Still, you'd think implicit persistence is something you'd have to turn on, not code away.

            • 3. Re: @End commits entity changes!
              whafrog

               

              "gsegura" wrote:
              I think this is related to the flush mode of the conversation, look for @Begin(flushMode=FlushModeType.MANUAL),
              I think that normally when conversation ends everything is flushed autommatically.

              I just posted a somewhat related question but there the conversation is not finished and yet I'm having an update, ok, no more crossposting :P


              Thanks, I'll check it out. Probably a better solution than clearing the entitymanager.