aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes A client is within a transaction and not associated with a transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "A client is within a transaction and not associated with a transaction" Watch "A client is within a transaction and not associated with a transaction" New topic
Author

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

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 813
    
    1
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
Bartender

Joined: Apr 07, 2010
Posts: 1734
    
  25

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)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A client is within a transaction and not associated with a transaction