|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.apache.commons.dbcp.AbandonedTrace
org.apache.commons.dbcp.DelegatingConnection
org.apache.commons.dbcp.managed.ManagedConnection
public class ManagedConnection
ManagedConnection is responsible for managing a database connection in a transactional environment (typically called "Container Managed"). A managed connection operates like any other connection when no global transaction (a.k.a. XA transaction or JTA Transaction) is in progress. When a global transaction is active a single physical connection to the database is used by all ManagedConnections accessed in the scope of the transaction. Connection sharing means that all data access during a transaction has a consistent view of the database. When the global transaction is committed or rolled back the enlisted connections are committed or rolled back. Typically upon transaction completion, a connection returns to the auto commit setting in effect before being enlisted in the transaction, but some vendors do not properly implement this. When enlisted in a transaction the setAutoCommit(), commit(), rollback(), and setReadOnly() methods throw a SQLException. This is necessary to assure that the transaction completes as a single unit.
| Field Summary |
|---|
| Fields inherited from interface java.sql.Connection |
|---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
|---|---|
ManagedConnection(org.apache.commons.pool.ObjectPool pool,
TransactionRegistry transactionRegistry,
boolean accessToUnderlyingConnectionAllowed)
|
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying connection, and close any Statements that were not explicitly closed. |
void |
commit()
|
java.sql.Connection |
getDelegate()
Returns my underlying Connection. |
java.sql.Connection |
getInnermostDelegate()
If my underlying Connection is not a
DelegatingConnection, returns it,
otherwise recursively invokes this method on
my delegate. |
boolean |
isAccessToUnderlyingConnectionAllowed()
If false, getDelegate() and getInnermostDelegate() will return null. |
void |
rollback()
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setReadOnly(boolean readOnly)
|
| Methods inherited from class org.apache.commons.dbcp.AbandonedTrace |
|---|
printStackTrace |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ManagedConnection(org.apache.commons.pool.ObjectPool pool,
TransactionRegistry transactionRegistry,
boolean accessToUnderlyingConnectionAllowed)
throws java.sql.SQLException
java.sql.SQLException| Method Detail |
|---|
public void close()
throws java.sql.SQLException
DelegatingConnection
close in interface java.sql.Connectionclose in class DelegatingConnectionjava.sql.SQLException
public void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectioncommit in class DelegatingConnectionjava.sql.SQLExceptionpublic java.sql.Connection getDelegate()
DelegatingConnectionConnection.
getDelegate in class DelegatingConnectionConnection.public java.sql.Connection getInnermostDelegate()
DelegatingConnectionConnection is not a
DelegatingConnection, returns it,
otherwise recursively invokes this method on
my delegate.
Hence this method will return the first delegate that is not a DelegatingConnection, or null when no non-DelegatingConnection delegate can be found by traversing this chain.
This method is useful when you may have nested
DelegatingConnections, and you want to make
sure to obtain a "genuine" Connection.
getInnermostDelegate in class DelegatingConnectionpublic boolean isAccessToUnderlyingConnectionAllowed()
public void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionrollback in class DelegatingConnectionjava.sql.SQLException
public void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.ConnectionsetAutoCommit in class DelegatingConnectionjava.sql.SQLException
public void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.ConnectionsetReadOnly in class DelegatingConnectionjava.sql.SQLException
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||