1 Reply Latest reply on Oct 3, 2010 11:16 PM by yahawari

    Starting a transaction in a Conversation

    cdecker

      I'm pretty new to transactions in seam, so please forgive me if this is trivial.


      I have a screen to edit a 2-dimensional table, each column is an attribute and each row represents an object. We can dynamically add and remove columns and rows, for this to work we have a rather complex table structure, but it works in the end.


      The problem arises when I want to add columns and rows (read: create new objects in the database) but then cancel the editing screen. Since the objects that represent the new fields, columns and rows are created on the server, they are automatically saved to the database, and not deleted at a cancel, which gives really strange results.


      Now I figured we could just wrap the entire editing in a database transaction which is rolled back when the user cancels the form.


      How could I do such a thing?

        • 1. Re: Starting a transaction in a Conversation
          yahawari

          conversations wrap transactions. when u start the conversation use manual flush mode.


          to cancel call a function that ends the conversation (see @End). declare the function that returns a string and make it return null. returning null will end the conversation and roll back the transaction (since u specified manual flush mode).


          hope it helps ...