File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes CMT and Connection Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply locked New topic

CMT and Connection Objects

Sandeep Vaid
Ranch Hand

Joined: Feb 27, 2006
Posts: 392
public void someMethod(...) {
// obtain con1 and con2 connection objects
con1 = ...;
con2 = ...;
stmt1 = con1.createStatement();
stmt2 = con2.createStatement();

// Perform some updates on con1 and con2. The container
// automatically enlists con1 and con2 with the container-
// managed transaction.

As we have specified TransactionAttributeType.REQUIRED, container will start a transaction (i guess on a Connection)
Q- a) Container will start transaction on which Connection (database) Object? From where it obtains information about my database ?
In other words does container uses JTA (Distributed transaction manager layer), from where it obtains info regarding my databses,
user password, url etc..
Q- b) What does the statement means "The container automatically enlists con1 and con2 with the container-manager transaction"?
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Duplicate of

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: CMT and Connection Objects
It's not a secret anymore!