Spring JTA Transaction Manager Question

We are using a managed jboss EntityMangerFactory using the following spring bean

<jee:jndi-lookup id="entityManagerFactory" jndi-name="persistence-units/myPU"/>

Now in our spring bean we use @PersistenceContext to get the entitymanager, and it works great. I want how can I tell spring to grab the transaction manager provided by jbos jta service and use it in my dao?

If I define txmanager as shown below, can spring take control of the drivetrain using the @Transaction annotation?

<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
      <property name="transactionManagerName" value="java:/TransactionManager"/>
    <property name="userTransactionName" value="UserTransaction"/>
</bean> 

If so, when will the spring commit the transaction and roll it back?

thank

+5
source share
1 answer

- transactionManager, txManager. , , .

, JtaTransactionManager, , JNDI, .

, JtaTransactionManager , <tx:jta-transaction-manager/>, Spring .

, , , :

<context:annotation-driven/>
<tx:jta-transaction-manager/> 

beans, @Transactional, , Spring, . , , (. ).

+17

All Articles