Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-4391

Need to add transaction propagation types to @Transactional

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.0.GA
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Environment:
      N/A

      Description

      The current tx propagation types for use with @Transactional are the following:

      REQUIRED, MANDATORY, SUPPORTS, NEVER;

      Here is a comment from the TransactionalPropagationType enum class:

      • Transaction propagation strategies for Seam JavaBean components. Note that unlike EJB3 components, there are no strategies for suspending transactions.

      Please add REQUIRES_NEW and NOT_SUPPORTED. I am unable to solve my functional requirement of calling a webservice which inserts into remote db (which does not require a tx) and inserting into multiple local db tables (requires tx) using JavaBean components and Seam @Transactional. The requirement is that even if the webservice call fails, the local db inserts should continue and succeed (i.e. no atomicity, no rollback).

      There is an action method in my JavaBean Seam component that is invoked from a commandButton in JSF page. Then there are two private methods that are invoked from that public method. One requires tx support, the other does not. With EJB3, I would simply use NOT_SUPPORTED for one and REQUIRES_NEW for the other. Now using JavaBeans and @Transactional, I cannot solve my problem in terms of tx support requirements. @Transactional only works on public methods.

      I tried recalling the component's private method (now refactored to public with @Transactional) using Component.getInstance("foo"); but that did not work.

      Spring has robust tx support like EJB 3. Seam needs to be ramped up in terms of tx support for JavaBean components.

      References:

      http://www.seamframework.org/Community/TransactionalPropagationTypes
      http://www.seamframework.org/Community/TransactionalOnPrivateMethod

        Gliffy Diagrams

        1. jbseam-requires-new-1.diff
          9 kB
          Stuart Douglas
        2. jbseam-requires-new-2.diff
          9 kB
          Stuart Douglas
        3. jbseam-requires-new-3.diff
          23 kB
          Stuart Douglas

          Issue Links

            Activity

            Hide
            swd847 Stuart Douglas added a comment -

            I have attached a patch that implements basic REQUIRES_NEW functionality.

            Show
            swd847 Stuart Douglas added a comment - I have attached a patch that implements basic REQUIRES_NEW functionality.
            Hide
            swd847 Stuart Douglas added a comment -

            Updated patch with a minor fix

            Show
            swd847 Stuart Douglas added a comment - Updated patch with a minor fix
            Hide
            swd847 Stuart Douglas added a comment -

            I have attached a patch that prevents the propegation of the SMPC across transaction boundaries and includes integration tests.

            Show
            swd847 Stuart Douglas added a comment - I have attached a patch that prevents the propegation of the SMPC across transaction boundaries and includes integration tests.
            Hide
            asookazian Arbi Sookazian added a comment -

            Cool!

            Show
            asookazian Arbi Sookazian added a comment - Cool!
            Hide
            andrei.ivanov Andrei Ivanov added a comment -

            Any chance for someone looking at this?

            Show
            andrei.ivanov Andrei Ivanov added a comment - Any chance for someone looking at this?

              People

              • Assignee:
                Unassigned
                Reporter:
                asookazian Arbi Sookazian
              • Votes:
                5 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Development