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?!


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111344#4111344

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111344
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to