• Post Reply Bookmark Topic Watch Topic
  • New Topic

Transaction Question from HF EJB page 479-480

 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all:
The solution to the sharpen your pencil exercise on page 480 does not indicate that the ut.begin() method is in a transaction. This seems to contradict what is show on the previous page in step one. Is there a contradition? Does begin() run in a transaction or does the transaction begin after the begin() method returns?
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Keith,
This seems to contradict what is show on the previous page in step one. Is there a contradition? Does begin() run in a transaction or does the transaction begin after the begin() method returns?

UserTransaction.begin() *starts* the transaction, so - by definition - it cannot execute *in* it.
Best,
Phil.
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Phillipe,
Thanks for clearing that up.
 
saran ram
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that means begin() is not in the transaction(that means, the previous page was wrong?) somebody plz clear things up?
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!