Package org.apache.openjpa.lib.jdbc
Class DelegatingConnection
java.lang.Object
org.apache.openjpa.lib.jdbc.DelegatingConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
,Closeable
- Direct Known Subclasses:
ConfiguringConnectionDecorator.ConfiguringConnection
,JDBCStoreManager.ClientConnection
,JDBCStoreManager.RefCountConnection
,LoggingConnectionDecorator.LoggingConnection
,PostgresDictionary.PostgresConnection
,SybaseDictionary.SybaseConnection
Wrapper around an existing connection. Subclasses can override the
methods whose behavior they mean to change. The
equals
and
hashCode
methods pass through to the base underlying data
store connection.- Author:
- Abe White
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
appendInfo
(StringBuffer buf) void
void
close()
void
commit()
createArrayOf
(String typeName, Object[] elements) protected Statement
createStatement
(boolean wrap) Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.createStatement
(int type, int concur) protected Statement
createStatement
(int type, int concur, boolean wrap) Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected Statement
createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) createStruct
(String typeName, Object[] attributes) boolean
boolean
getClientInfo
(String name) Return the wrapped connection.int
Return the base underlying data store connection.protected DatabaseMetaData
getMetaData
(boolean wrap) Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData
, which is the default.int
int
int
hashCode()
boolean
isClosed()
boolean
boolean
isValid
(int timeout) boolean
isWrapperFor
(Class<?> iface) prepareCall
(String str) protected CallableStatement
prepareCall
(String str, boolean wrap) Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.prepareCall
(String str, int type, int concur) protected CallableStatement
prepareCall
(String str, int type, int concur, boolean wrap) Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected CallableStatement
prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) prepareStatement
(String str) protected PreparedStatement
prepareStatement
(String str, boolean wrap) Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.prepareStatement
(String sql, int autoGeneratedKeys) prepareStatement
(String sql, int[] columnIndexes) protected PreparedStatement
prepareStatement
(String sql, int[] columnIndexes, boolean wrap) protected PreparedStatement
prepareStatement
(String sql, int autoGeneratedKeys, boolean wrap) prepareStatement
(String str, int type, int concur) protected PreparedStatement
prepareStatement
(String str, int type, int concur, boolean wrap) Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected PreparedStatement
prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) prepareStatement
(String sql, String[] columnNames) protected PreparedStatement
prepareStatement
(String sql, String[] columnNames, boolean wrap) void
releaseSavepoint
(Savepoint savepoint) void
rollback()
void
void
setAutoCommit
(boolean bool) void
setCatalog
(String str) void
setClientInfo
(String name, String value) void
setClientInfo
(Properties properties) void
setHoldability
(int holdability) void
setNetworkTimeout
(Executor executor, int milliseconds) void
setReadOnly
(boolean bool) setSavepoint
(String savepoint) void
void
setTransactionIsolation
(int i) void
setTypeMap
(Map<String, Class<?>> map) toString()
<T> T
From java.sql.Wrapper javadoc: Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Constructor Details
-
DelegatingConnection
-
-
Method Details
-
getDelegate
Return the wrapped connection. -
getInnermostDelegate
Return the base underlying data store connection. -
hashCode
public int hashCode() -
equals
-
toString
-
appendInfo
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatement
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.- Throws:
SQLException
-
nativeSQL
- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLException
-
commit
- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Throws:
SQLException
-
isClosed
- Specified by:
isClosed
in interfaceConnection
- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaData
in interfaceConnection
- Throws:
SQLException
-
getMetaData
Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData
, which is the default.- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnly
in interfaceConnection
- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnly
in interfaceConnection
- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalog
in interfaceConnection
- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalog
in interfaceConnection
- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
getWarnings
- Specified by:
getWarnings
in interfaceConnection
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatement
Create a statement, with the option of not wrapping it in aDelegatingStatement
, which is the default.- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String str, int type, int concur, boolean wrap) throws SQLException Prepare a statement, with the option of not wrapping it in aDelegatingPreparedStatement
, which is the default.- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
protected CallableStatement prepareCall(String str, int type, int concur, boolean wrap) throws SQLException Prepare a call, with the option of not wrapping it in aDelegatingCallableStatement
, which is the default.- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMap
in interfaceConnection
- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMap
in interfaceConnection
- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldability
in interfaceConnection
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldability
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepoint
in interfaceConnection
- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatement
protected Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
protected CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, int autoGeneratedKeys, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, int[] columnIndexes, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, String[] columnNames, boolean wrap) throws SQLException - Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
From java.sql.Wrapper javadoc: Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the wrapped object. Otherwise return the the result of calling unwrap recursively on the wrapped object or a proxy for that result. If the receiver is not a wrapper and does not implement the interface, then an SQLException is thrown.- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
createArrayOf
- Specified by:
createArrayOf
in interfaceConnection
- Throws:
SQLException
-
createBlob
- Specified by:
createBlob
in interfaceConnection
- Throws:
SQLException
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
createNClob
- Specified by:
createNClob
in interfaceConnection
- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXML
in interfaceConnection
- Throws:
SQLException
-
createStruct
- Specified by:
createStruct
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
isValid
- Specified by:
isValid
in interfaceConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-