• Post Reply Bookmark Topic Watch Topic
  • New Topic

A client is within a transaction and not associated with a transaction

 
Himai Minh
Ranch Hand
Posts: 1400
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In J2EE 6 tutorial, container managed transaction, it says something like if a client is within a transaction.... and if a client is not associated with a transaction.....

An example quote from http://docs.oracle.com/javaee/6/tutorial/doc/bncij.html
Required Attribute
If the client is running within a transaction and invokes the enterprise bean’s method, the method executes within the client’s transaction. If the client is not associated with a transaction, the container starts a new transaction before running the method.


How do we know if the client is running within a transaction ? How do we know if the client is not associated with a transaction?
In this case, is bean 2 in Figure 44-1 the client or bean 1 the client?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2791
181
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Himai,

Himai Minh wrote:How do we know if the client is running within a transaction ? How do we know if the client is not associated with a transaction?

Well, the thing with Container Managed Transactions is that we don't have to know whether the client is running inside a transaction. The container knows whether the client is running within a transaction (because it keeps records of this)

Himai Minh wrote:
In this case, is bean 2 in Figure 44-1 the client or bean 1 the client?

Bean 1 is the client of Bean 2 (it invokes a method on another EJB)

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!