0 Replies Latest reply on Jan 15, 2008 9:01 AM by dreuzel

    transactions  all I try seems to fail

      I'm trying to follow advise and running nowhere
      trying to set up a manual JTA transaction
      All advice from the forums seems not to work or to fail (I probably attack it from the wrong angle )
      I define JTA eplicitely in the persistence.xml


       <persistence-unit name="httpscan" transaction-type="JTA">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <!-- <jta-data-source>java:/httpscanDatasource</jta-data-source> -->
       <jta-data-source>java:/DevelopmentDS</jta-data-source>
       <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
       <property name="hibernate.jdbc.batch_size" value="20"/>
      
       <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <!-- use a file system based index -->
      
      

      from the manual :
      You could manage your transactions manually using the JTA UserTransaction (you could even implement your own declarative transaction management in a Seam interceptor). But most applications will use Seam managed transactions...

      but all I do seems to fail.


       <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"
      



      where and how do I get the Transaction Context ????


       try{
       iniCtx= new InitialContext();
       tx=(UserTransaction) iniCtx.lookup("java:comp/UserTransaction");
       } catch (Exception er )
       {errcod=er;
       String errmsg=er.getClass().getSimpleName() +" err: "+ er.getMessage();
       log.error(env+" starting transaction failed "+ errmsg);
       }
      


      Does not work since the Class Cast Fails and probaly
      i can not correctly set java:comp/UserTransaction....


      trying to use Seam fails as well


       tx=Transaction.instance();
       if (tx.getStatus()== Status.STATUS_ACTIVE) tx.commit();//commit a first transaction
       } catch (Exception er )
       {errcod=er;
       String errmsg=er.getClass().getSimpleName() +" err: "+ er.getMessage();
       log.error(env+" starting transaction failed "+ errmsg);
       }
      
      


      does not allow the transaction to begin

      Tx.begin() Unupported error


      I tried JPA but afer 1000 or so operations it fails on begin as well


      can someone

      pass me some example code


      a) the Impors used to ensure I've the right TRANSACTION definitions


      b) get the transaction context
      c) the related tx.begin()
      d) em.flush()
      e) tx.comit()
      f) ...