1 Reply Latest reply on Jan 23, 2008 12:41 PM by pmuir

    Seam self managed transactions DOES NOT WORK

      I have an application with the need to handle the transactions myself.

      this means em.begin
       em.query
       em.commit or rollback
      
       when I Want it without
       interference of any CONTAINER transactions
      
      


      I agree there are situations, where they are usefull
      BUT I NEED THE CONTROLL in MY CASE
      A) I switched of Seam Transaction controll as is explained in the manual
      B)
       I DID experiment with
       //@TransactionManagement(TransactionManagementType.BEAN) //instead of Container
      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) //suspend all active container transactions
      


      persistence jta
       <!-- <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/> -->
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
      



       <core:init debug="@debug@" jndi-pattern="@jndiPattern@" transaction-management-enabled="false" />
       conversation-timeout="12000000" -->
       <core:manager concurrent-request-timeout="5000000"
       conversation-timeout="200000000"
       conversation-id-parameter="cid"/>
      
       <persistence:managed-persistence-context name="entityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/httpscanEntityManagerFactory"/>
      




      I still get into a lot of trouble

      or at sesion.begin
      Begin starting transaction failed TransactionException err: Could not register synchronization for container transaction
      


      I do not want to use Container managed transactions since I want it to be controlled by myself



       org.hibernate.Transaction txn=null;//
       boolean rollback=false;
      // javax.persistence.EntityManagerFactory Ef=
       //reset timeout
       // if (EM!=null) em=EM;
       try { env="Timeout";
       org.jboss.seam.transaction.Transaction.instance().setTransactionTimeout(60*60*10000000);
       } catch (Exception er)
       {errcod=er;
       String errmsg=er.getClass().getSimpleName() +" err: "+ er.getMessage();
       log.error(env+" Modifying timeout failed "+ errmsg);
       }
       // seam timeout
       try { env ="seam timeout";
       org.jboss.seam.transaction.Transaction.instance().setTransactionTimeout(60*60*10000000);} catch (Exception er)
       {errcod=er;
       String errmsg=er.getClass().getSimpleName() +" err: "+ er.getMessage();
       log.error(env+" Modifying Seam timeout failed "+ errmsg);
       }
      



      I even tried to setup a separate entityManager from JNDI

      but hten the queries do not relate tot the transactions


      Has anyone done this simple operation ?

      Is it possible to disable the container transaction functionality
      and do the BEGIN-COMMIT-Rollback independent
      of container optimisations



      all help is welcome, i'm getting desperate


      or it complains ther are NO transactions