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

Bean Manage Transaction Propagation.

 
Rajitha Gunawardhane
Ranch Hand
Posts: 43
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to if BMT are propagating to the clients or not. I assume it is not every time when UserTransaction.beging() it is holding the current transaction(if it is there) and starting a new one. Please correct me if i am wrong.

If what i understood is correct, what is the correct answer for following question.

You are developing a session bean having two methods m1 and m2 that must have the following functionality "Both the methods will be called by the client in the same transaction scope".

Is it BMT or CMT?

Thank you.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Quote Your Sources.
 
Rajitha Gunawardhane
Ranch Hand
Posts: 43
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:Please Quote Your Sources.


Hi Frits,

I am sorry. It is my mistake. But not a small one. I will follow it.
Thank you for notifying me.

It from your product. Enthuware.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajitha Gunawardhane wrote:I am sorry. It is my mistake. But not a small one. I will follow it. 

No problem.

Are you by any chance reading my notes? You can find them here: OCEEJBD-Links

You might want to check chapter 5.4.3 and 5.4.4. What do you think is the answer after reading those paragraphs?
 
Rajitha Gunawardhane
Ranch Hand
Posts: 43
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:
Rajitha Gunawardhane wrote:I am sorry. It is my mistake. But not a small one. I will follow it. 

No problem.

Are you by any chance reading my notes? You can find them here: OCEEJBD-Links

You might want to check chapter 5.4.3 and 5.4.4. What do you think is the answer after reading those paragraphs?


Yes! It is really helpful. That is what i am referring . And i have enthuware mock as well .

As in 5.4.3 section
"A client transaction is always suspended when it calls a Bean-managed EJB (even if the client is another Bean Managed EJB)."

So as it need both methods to have same client's transaction, It cant be in BMT, because if it is BMT then client's transaction is suspending.

Am i correct?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes! It is really helpful. That is what i am referring . And i have enthuware mock as well .

 

So as it need both methods to have same client's transaction, It cant be in BMT, because if it is BMT then client's transaction is suspending.
Am i correct? 

Yes!
 
Rajitha Gunawardhane
Ranch Hand
Posts: 43
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Frits Walraven wrote: Yes!


Thank you!.
 
Rajitha Gunawardhane
Ranch Hand
Posts: 43
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:
Yes! It is really helpful. That is what i am referring . And i have enthuware mock as well .

 

So as it need both methods to have same client's transaction, It cant be in BMT, because if it is BMT then client's transaction is suspending.
Am i correct? 

Yes!


In that case for following question why it should be BMT?

You are developing a session bean having two methods m1 and m2 that must have the following functionality - 1. Both the methods will be called by the client in the same transaction scope. 2. You need to dynamically set the transaction timeout for the transaction in bean method m1 based on certain parameters.
(Source: Enthuware mock)
 
Jhonson Fernando
MyExamCloud Software Support
Ranch Hand
Posts: 683
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can use CMT with transaction scope as REQUIRED for both m1 and m2 to achieve this goal.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No you can't use a CMT.

In that case for following question why it should be BMT? 

  • Because a transaction timeout can only be set by using the UserTransaction Interface (and a UserTransaction can only be used in a BMT).

  • and

  • Both methods (m1 and m2) can only run in the same (target) transaction scope if the target bean is a Stateful Session Bean. Note that client's transaction will be suspended in both method calls. The question doesn't make clear, however, that "the same transaction scope" applies to either the client or the bean you are developing. It is good to know that you will have two different transaction scopes in this question.
  •  
    Rajitha Gunawardhane
    Ranch Hand
    Posts: 43
    Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you Frits and Jhonson,

    What i also though was CMT with REQUIRED.

    After the detail explanation about the  question, i am clear about the answer.


    Thank you all.

     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic