9 Replies Latest reply on Nov 20, 2008 11:03 AM by Toni Beckman

    JTA transaction timeout

    Daniel Wachter Newbie


      i have a function which reads data from the db, make some calculations and write the data in csv files. the runtime of this function is about 7 minutes. i know, that i can set the transactional timeout in the jboss-service.xml which i tryed and works perfectly! (the function is inside a statless, seam bean with a managed entity manager.)

      is there any other way to solve my problem with the transaction timeout. since i only have read-only operations i don't even need a such long transaction...
      (i don't want to disable the seam managed transactions for the hole application)

      any ideas?

      thx for helping...

        • 1. Re: JTA transaction timeout
          Guillaume Jeudy Master

          If your function is inside an EJB3 you can annotate it:


          Although others report that @TransactionTimeout doesn't work its probably worth trying as it is part of the suggested solution.

          Let us know how it goes.

          • 2. Re: JTA transaction timeout
            Daniel Wachter Newbie

            thank you for your reply, i will try your solution
            and will report the result later...

            • 3. Re: JTA transaction timeout
              Daniel Wachter Newbie

              hello guillaume

              sorry for my late answer.
              for me your solution worked perfectly!


              it would be much butter if my action would create a new transaction on each method call but i think this is nod possible with seam managed transactions...

              • 4. Re: JTA transaction timeout
                Guillaume Jeudy Master

                hi daniel,

                This is what


                does. When the EJB container sees it on a business method call it suspends any caller transaction to start a new one.

                For @TransactionTimeout to work you have to start a new transaction. In other words @TransactionTimeout is ignored if your method joins an already running transaction.

                • 5. Re: JTA transaction timeout
                  Toni Beckman Novice


                  I'm using


                  on the method of a SFSB because the database update takes longer than the default of 300 seconds.

                  However, the annonation does not increase the transaction timeout, if used alone. The transaction always times out after 5 minutes, no matter what value. I had to increase the global transaction timeout. Only raising it helps.

                  I tried from this thread to combine @TransactionTimeout with @TransactionAttribute(TransactionAttributeType.REQUIRESNEW) which helps. The timeout all of a sudden changes. So using @TransactionAttribute(TransactionAttributeType.REQUIRESNEW) in combination with @TransactionTimeout works, but only PARTLY.

                  The problem is that after the method completes NONE of the changes are persisted and no error is thrown. This is really weird. I have noticed this issue before unfortunantely nobody really seems to care about this.

                  Has anybody some solid explanation for this?

                  • 6. Re: JTA transaction timeout
                    Guillaume Jeudy Master

                    what is the flush mode set on your persistence context? If its set to manual then unless you explicitely flush the context it will never execute SQL statements in the database.

                    • 7. Re: JTA transaction timeout
                      Toni Beckman Novice

                      No flush mode is set anywhere in my code or in my .xml files so I guess it's the default flush mode.

                      • 8. Re: JTA transaction timeout
                        Stephanie Stroka Newbie

                        Maybe you are using @Transactional on a method that is wrapped around by another Transaction. If this is true, the Transaction Timeout of the outer Transaction is used.

                        • 9. Re: JTA transaction timeout
                          Toni Beckman Novice

                          This is probably the case, because adding


                          to the method changes the timeout to the desired value. Unfortunately none of the actions are persisted.

                          On the other hand I'm wondering why there should be another transaction. The SFSB is dealing with the clients. The method that is called deletes a client and is referenced in the jsp via an normal action. It takes about 7 minutes to complete. In the method nothing else is referenced or used but entity beans.