2 Replies Latest reply on Apr 5, 2011 3:38 PM by planetenkiller

    No JTA transaction found - Transacational inserts and updates not working

    davestar

      I have a Spring 3.0.5 application deployed in JBoss 5.1 with JPA entities using

      javax.persistence.EntityManager for database operations like entityManager.find(id), entityManager.persist(object), entityManager.merge(object)

      All my get() and getAll() operations are working fine but any persist or merge operations are not working neither am I seeing any exceptions or errors thrown in the JBoss logs.  When I enable debug on the server I see the below two lines being repeated everytime a database operation is performed.


      17:10:01,505 DEBUG [AbstractEntityManagerImpl] Looking for a JTA transaction to join
      17:10:01,520 DEBUG [AbstractEntityManagerImpl] No JTA transaction found
      
      
      


      Can you please help me identify the cause of this message? or why transactions are not working?  Thanks for the help.

       

      My persistence.xml

       

         <persistence-unit name="ties-2" transaction-type="JTA">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <jta-data-source>java:/ties-2Datasource</jta-data-source>
            <!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->
            <properties>
               <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
      <!--         <property name="hibernate.hbm2ddl.auto" value="validate"/>-->
      <!--   <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>-->
               <property name="hibernate.show_sql" value="true"/>
               <property name="hibernate.format_sql" value="true"/>
               <property name="jboss.entity.manager.factory.jndi.name" value="java:/ties-2EntityManagerFactory"/>
                 
            </properties>
         </persistence-unit>
      
      
      My spring jpa config
      
      <beans>
      <!-- JPAAccountDAO has JPA annotations to access EntityManager -->
          <context:annotation-config/> 
       <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/ties-2EntityManagerFactory">
       </jee:jndi-lookup> 
       <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
                <property name="transactionManagerName" value="java:/TransactionManager"/>
              <property name="userTransactionName" value="UserTransaction"/>
          </bean>
       <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
       <!-- Database LOB Handling -->
       <bean id="defaultLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" />
       <!-- Read in DAOs from the JPA package -->
       <context:component-scan base-package="com.rtd.ties2.dao" />  
      </beans>