This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use of UserTransaction  RSS feed

 
Haroldo Nascimento
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a 3 doubts. I implements the client (servlet) that get the userTransaction of Context using this code:

UserTransaction userTrx = (UserTransaction)jndiCtx.lookup("jta/usertransaction");
String temp = null;

userTrx.begin();
temp = "value";
userTrx.roolback();
System.out.println(temp);

My doubt is: The value of temp will "value" or null ?

What is the advantage of use transaction without EJB ?

I can controll in the rollback of the object UserTransaction (get with lookup of context) the command rollback of transaction of DB together without use EJB ?

Thanks
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a JTA transaction only affects resources that can be "enlisted" in the transaction: JDBC connections, JMS queues, etc. While you could certainly write code that would wrap a String and make it transactional, that's not a part of standard Java.
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UserTransaction interface gives control to you,to manage your transaction in your program and container won't take care of Transaction Management.

Regards,

James
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!