2 Replies Latest reply on Jul 16, 2007 11:36 AM by Philipp Straub

    Transaction Timeout

    Philipp Straub Newbie

      Hi all,

      I have an action (a button on my page) that starts a long database transaction. The action create entities. After an entity is created I always flush and clear the EntityManager. Everything works great for a little more than 3 minutes. Then everything gets really slow and then I get this warning:

      [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1184597546875/5, BranchQual=null:1184597546875, localId=0:5] timed out. status=STATUS_ACTIVE
      


      I've tried a few thing:
      - change timeouts of session/conversation
      - made my bean containing the action into a stateless bean, made it bean-managed and set the transaction timeout to a high value
      ...

      Nothing had any effect.

      Does anyone know how to change the transaction timout setting. Best would be a possibity to change it just for one method.

      I'm using Seam 1.2.1 on Tomcat 5.5 with embedded EJB and Seam managed transactions

      Thanks!

        • 1. Re: Transaction Timeout
          Gavin King Master

          In Seam2 you can use Transaction.instance().setTransactionTimeout(...).

          Otherwise, in Seam 1.2.1, use the EE5 standard approach to get the UserTransaction object.

          • 2. Re: Transaction Timeout
            Philipp Straub Newbie

            Unfortunately I can't switch to Seam 2 yet (But I'm really looking forward to).

            The other approach doesn't have any effect. Here is what I do:

            @Stateless
            @TransactionManagement(TransactionManagementType.BEAN)
            @Name("fillDatabase")
            public class FillDatabaseAction implements FillDatabase {
            
             @Resource
             private UserTransaction userTransaction;
            
             ...
            
            
             public void execute() {
            
             try {
             userTransaction.setTransactionTimeout(60*60);
             userTransaction.begin();
             doIt();
             userTransaction.commit();
            
             ...
            



            Thanks for your quick reply!