Results 1 to 2 of 2

Thread: How does JtaTransactionManger know which datasource need to synchronize with?

  1. #1

    Post How does JtaTransactionManger know which datasource need to synchronize with?

    Hi,

    in below code snippet:

    <bean id="txManager" class="org.springframework.transaction.jta.JtaTran sactionManager"/>

    we donot need to specify any datasource,then how does JtaTransactionManager know which datasource(if we need some particulars) need to synchronize with."The JtaTransactionManager does not need to know about the DataSource, or any other specific resources, because it uses the container's global transaction management infrastructure." can someone help me on this how can transction manager know about datasource?

  2. #2
    Join Date
    Mar 2012
    Posts
    4

    Default

    I don't know if this would help you, but I have this spring context configuration:
    Code:
    <tx:annotation-driven transaction-manager="transactionManager"/>
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
    	<property name="persistenceUnitName" value="transactions-optional"/>
    </bean> 
    <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    	<property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>
    Also my application have persistence.xml in the META-INF folder, file which has the connection URL in my case. Which have this:
    <persistence-unit name="transactions-optional">

    I'm not a Spring expert however it shows that this is how things are wired together.

    Also I found this just a while ago:
    http://www.slideshare.net/junyuo/spr...p-presentation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •