Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Bean Manage Transaction Propagation.

 
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.
 
Creator of Enthuware JWS+ V6
Posts: 3294
297
Android Eclipse IDE Chrome
  • 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
Posts: 3294
297
Android Eclipse IDE Chrome
  • 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
Posts: 3294
297
Android Eclipse IDE Chrome
  • 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)
 
MyExamCloud Software Support
Posts: 692
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
Posts: 3294
297
Android Eclipse IDE Chrome
  • 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.

     
    Whose rules are you playing by? This tiny ad doesn't respect those rules:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!