4 Replies Latest reply on Dec 14, 2007 11:14 AM by whafrog

    Conversation times out, entity manager persists??

    whafrog

      I have successfully avoided having the entity manager persist entity changes when the user quits a conversation on purpose, by coding as follows:

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


      However, when the conversation times out, the entity manager is flushed anyway. So I added the following to the starting method:

      @Begin(join=true, flushMode=FlushModeType.MANUAL)
       @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
       public String startProcess()...
      


      With flushMode set to true, in the method where I actually want persistence, I make sure to make a call to entityManager.flush();

      Except any entity changes that are abandoned are still persisted after the conversation times out. What more must I do to keep the over zealous entity manager from persisting? And, larger question, why is this the default behavior?!