Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction Demarcation

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Looks weird, but is it valid?

Also, what are the tranaction attributes allowed on timeout methods? and why?
 
Promod kumar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Niranjan,

Yes, it is valid. This is one of the things that you can only do with BMT, start a transaction in one method of a stateful session bean and commit in another method. This is discussed a little bit in EJB3 in action, page 201, section 6.3.4

As for timeout method, Required or Requires_New are allowed (refer to the sidebar EJB Timers and Transactions, page 173 of the same book). I am not sure why only these two are allowed, I am suspecting because the container is invoking the timeout method not a client.
 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Promod Mahajan wrote:As for timeout method, Required or Requires_New are allowed.


As I heard, NOT_SUPPORTED is also available, in addition to above two types.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Pramod,

Thanks for pointing the relevant pages. The page 201 also says

Another drawback for BMT is the fact that it can never join an existing transaction. Existing transactions are always suspended when calling a BMT method, significantly limiting flexible component reuse.


To avoid this we use joinTransaction( ). Correct?

@Clark,
Yes I have read in Java Beat that NOT_SUPPORTED is also one of the supported types for Time out methods.
 
Jun Liu
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To avoid this we use joinTransaction( ). Correct?


No. joinTransaction() is a method of EntityManager. It allows the EntityManager created outside the transcation can join the current transaction. It has nothing to do with the discussion of BMT here.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops! I mixed up thigs terribly!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic