Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

In which situation JTA will be used

 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone tell me in which situations JTA will be used and also put some focus on JDBC transaction and JTA Transaction with an Example
Thank
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTA will need to be used in any situation in which you need 2-phase commit across two or more datasources. For instance, if you need to update both a local Oracle database and a remote DB2 database on the mainframe in the same transaction so that the two will not get out of sync. Or, if you need to both update an Oracle database and place a message on a JMS queue in such a way that if either fails, the other rolls back...
Kyle
 
ravi inguva
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the above example u mentioned cannot be achived using container managed transaction is not why???

Originally posted by Kyle Brown:
JTA will need to be used in any situation in which you need 2-phase commit across two or more datasources. For instance, if you need to update both a local Oracle database and a remote DB2 database on the mainframe in the same transaction so that the two will not get out of sync. Or, if you need to both update an Oracle database and place a message on a JMS queue in such a way that if either fails, the other rolls back...
Kyle
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container managed transactions (and bean managed transactions -- any time where you are defining an EJB transaction either programatically through UserTransaction or through the ejb-jar.xml transaction attributes) automatically use JTA when more than one datasource is involved. Are you asking when you would use JTA outside of container-managed transactions? The answer to that is never....
Kyle
[ March 15, 2002: Message edited by: Kyle Brown ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!