This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

CMT and Connection Objects

Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Report post to moderator
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"?
    Bookmark Topic Watch Topic
  • New Topic