0 Replies Latest reply on Jan 18, 2008 5:29 AM by Alexandros Karypidis

    Aborting transactions by clearing the persistence context

    Alexandros Karypidis Novice


      I'm rather inexperienced in J2EE and even more so with Seam, so I need some feedback regarding the following "trick" I've come up with:

      I have the typical scenario where a web page backed by a stateful session bean is used to edit some entities, with all changes performed in ACID fashion when a "save()" action is called on the SSB.

      To gracefully abort the transaction without throwing an exception I simply call em.clear(), and return to another web page that shows a list of entities and a facesMessage that editing was aborted.

      In the book "JBoss Seam, simplicity and power beyond Java EE" there's an entire chapter dedicated on rolling back transactions. Why is the detachment of entities not mentioned? Is there something wrong with this approach?