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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidappendInfo(StringBuffer buf) voidvoidclose()voidcommit()createArrayOf(String typeName, Object[] elements) protected StatementcreateStatement(boolean wrap) Create a statement, with the option of not wrapping it in aDelegatingStatement, which is the default.createStatement(int type, int concur) protected StatementcreateStatement(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 StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) createStruct(String typeName, Object[] attributes) booleanbooleangetClientInfo(String name) Return the wrapped connection.intReturn the base underlying data store connection.protected DatabaseMetaDatagetMetaData(boolean wrap) Return the metadata, with the option of not wrapping it in aDelegatingDatabaseMetaData, which is the default.intintinthashCode()booleanisClosed()booleanbooleanisValid(int timeout) booleanisWrapperFor(Class<?> iface) prepareCall(String str) protected CallableStatementprepareCall(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 CallableStatementprepareCall(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 CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) prepareStatement(String str) protected PreparedStatementprepareStatement(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 PreparedStatementprepareStatement(String sql, int[] columnIndexes, boolean wrap) protected PreparedStatementprepareStatement(String sql, int autoGeneratedKeys, boolean wrap) prepareStatement(String str, int type, int concur) protected PreparedStatementprepareStatement(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 PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) prepareStatement(String sql, String[] columnNames) protected PreparedStatementprepareStatement(String sql, String[] columnNames, boolean wrap) voidreleaseSavepoint(Savepoint savepoint) voidrollback()voidvoidsetAutoCommit(boolean bool) voidsetCatalog(String str) voidsetClientInfo(String name, String value) voidsetClientInfo(Properties properties) voidsetHoldability(int holdability) voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetReadOnly(boolean bool) setSavepoint(String savepoint) voidvoidsetTransactionIsolation(int i) voidsetTypeMap(Map<String, Class<?>> map) toString()<T> TFrom 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, waitMethods 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:
createStatementin 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:
prepareStatementin 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:
prepareCallin 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:
nativeSQLin interfaceConnection- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
commit
- Specified by:
commitin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException
-
isClosed
- Specified by:
isClosedin interfaceConnection- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaDatain 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:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
getWarnings
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin 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:
prepareStatementin 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:
prepareCallin 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:
getTypeMapin interfaceConnection- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatementin 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:
prepareStatementin 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:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
protected CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, int autoGeneratedKeys, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, int[] columnIndexes, boolean wrap) throws SQLException - Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
protected PreparedStatement prepareStatement(String sql, String[] columnNames, boolean wrap) throws SQLException - Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin 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:
unwrapin interfaceWrapper- Throws:
SQLException
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-