kshacks
Sep 23rd, 2004, 12:25 AM
Hi
I am new to spring and had a basic query regarding spring jta transaction manager.
below mentioned is a snippet from the reference documentation
------------------------------------------------------------
If we use JTA, as in the dataAccessContext-jta.xml file from the same sample application, we need to use a container DataSource, obtained via JNDI, and a JtaTransactionManager implementation. The JtaTransactionManager doesn't need to know about the DataSource, or any other specific resources, as it will use the container's global transaction management.
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>jdbc/jpetstore</value></property>
</bean>
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransaction Manager"/>
-----------------------------------------------------------------------
what do u mean by the statement - "JtaTransactionManager doesn't need to know about the DataSource, or any other specific resources, as it will use the container's global transaction management." --
does it mean that if we specify the transaction manager as JtaTransactionManager , then it will use the application servers transaction management features ? if that is the case then if i declaritively mark my methods in POJO's using the spring declarative transaction management features and deploy the entire app in a application server , then automatically spring will take advantage of the transaction manager features of the app server and have the app server abide by the declarative features mentioned by spring for the POJO's ?
Moreover if the JtaTransactionManager does not need to know about the data soource then why have we declared bean id - dataSource ? what is its purpose ?
Basically I wanted to get a clear understanding of how does spring actually provide transaction management feautures to POJO's by using the JtaTransactionManager .
Can anyone please explain in simple terms. I have used EJB's in a transactional environment but am not able to figure out what magic happens if I apply the same declarative features to my POJO's.
Thanks
Keith
I am new to spring and had a basic query regarding spring jta transaction manager.
below mentioned is a snippet from the reference documentation
------------------------------------------------------------
If we use JTA, as in the dataAccessContext-jta.xml file from the same sample application, we need to use a container DataSource, obtained via JNDI, and a JtaTransactionManager implementation. The JtaTransactionManager doesn't need to know about the DataSource, or any other specific resources, as it will use the container's global transaction management.
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>jdbc/jpetstore</value></property>
</bean>
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransaction Manager"/>
-----------------------------------------------------------------------
what do u mean by the statement - "JtaTransactionManager doesn't need to know about the DataSource, or any other specific resources, as it will use the container's global transaction management." --
does it mean that if we specify the transaction manager as JtaTransactionManager , then it will use the application servers transaction management features ? if that is the case then if i declaritively mark my methods in POJO's using the spring declarative transaction management features and deploy the entire app in a application server , then automatically spring will take advantage of the transaction manager features of the app server and have the app server abide by the declarative features mentioned by spring for the POJO's ?
Moreover if the JtaTransactionManager does not need to know about the data soource then why have we declared bean id - dataSource ? what is its purpose ?
Basically I wanted to get a clear understanding of how does spring actually provide transaction management feautures to POJO's by using the JtaTransactionManager .
Can anyone please explain in simple terms. I have used EJB's in a transactional environment but am not able to figure out what magic happens if I apply the same declarative features to my POJO's.
Thanks
Keith