Package de.hybris.platform.jdbcwrapper
Class ConnectionImpl
- java.lang.Object
-
- de.hybris.platform.jdbcwrapper.WrapperRelease<java.sql.Statement>
-
- de.hybris.platform.jdbcwrapper.ConnectionImpl
-
- All Implemented Interfaces:
ParsedStatement,java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
- Direct Known Subclasses:
JUnitConnectionImpl
public class ConnectionImpl extends WrapperRelease<java.sql.Statement> implements java.sql.Connection, ParsedStatement
Wrapper for the jdbc Connection class CAUTION: Please be aware that this file will be compiled by using jdk 1.6 and jdk 1.7,
for being successful in both cases we have to suppress the generation of the @override annotation. So please DONT OPEN/SAVE this file by using eclipse !!!!
-
-
Constructor Summary
Constructors Constructor Description ConnectionImpl(HybrisDataSource dataSource, java.sql.Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(java.util.concurrent.Executor executor)protected voidassureWritable()protected voidautoRollbackOnUnsetTxBOund()voidclearWarnings()voidclose()if this connection is not TX bound, it is returned to the JDBC Connection pool If it is TX bound, we do nothing, because the next DataSourceImpl.getConnection() will return exactly this connection.voidcloseUnderlayingConnection()voidcommit()protected voidcommitInternal()java.sql.ArraycreateArrayOf(java.lang.String arg0, java.lang.Object[] arg1)java.sql.BlobcreateBlob()java.sql.ClobcreateClob()java.sql.NClobcreateNClob()java.sql.SQLXMLcreateSQLXML()java.sql.StatementcreateStatement()java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.StructcreateStruct(java.lang.String arg0, java.lang.Object[] arg1)booleangetAutoCommit()java.lang.StringgetCatalog()java.util.PropertiesgetClientInfo()java.lang.StringgetClientInfo(java.lang.String arg0)intgetConnectionID()returns the connection ID which is a unique ID which is counted up after each creation of a new connectionprotected java.lang.StringgetConnectionInfo()HybrisDataSourcegetDataSource()intgetHoldability()java.sql.DatabaseMetaDatagetMetaData()intgetNetworkTimeout()java.lang.StringgetSchema()intgetTransactionIsolation()java.util.MapgetTypeMap()java.sql.ConnectiongetUnderlayingConnection()returns the underlying physical java.sql.Connectionjava.sql.SQLWarninggetWarnings()protected booleangotError()protected booleanhasBeenRollbacked()voidinvalidate()booleanisClosed()protected booleanisFlexibleSyntax(java.lang.String query)logic for recognizing if 'query has' flexible search syntax if { or } happends to ba after from else in first 20 signs of the query - less reliablebooleanisReadOnly()booleanisTxBound()booleanisTxBoundUserTA()booleanisValid(int timeout)booleanisWrapperFor(java.lang.Class<?> arg0)protected voidlogError(java.sql.SQLException e, java.lang.String message)java.lang.StringnativeSQL(java.lang.String sql)protected voidnotifyError(java.sql.SQLException cause)protected voidnotifyStatementClosed(StatementImpl stmt)java.lang.StringparseQuery(java.lang.String queryIn)java.sql.CallableStatementprepareCall(java.lang.String sql)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)voidprepareForUse()java.sql.PreparedStatementprepareStatement(java.lang.String sql)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)protected voidprotectReadOnly(java.lang.String sql)protected voidreleaseResourceImpl(java.sql.Statement resource)voidreleaseSavepoint(java.sql.Savepoint savepoint)voidresetError()voidrestoreAfterUse()protected voidrestoreAutoCommit()protected voidrestoreTxIsolationLevel()voidrollback()voidrollback(java.sql.Savepoint savePoint)protected voidrollbackInternal()voidsetAutoCommit(boolean autoCommit)voidsetCatalog(java.lang.String catalog)voidsetClientInfo(java.lang.String arg0, java.lang.String arg1)voidsetClientInfo(java.util.Properties arg0)voidsetHoldability(int holdability)voidsetNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)java.sql.SavepointsetSavepoint()java.sql.SavepointsetSavepoint(java.lang.String name)voidsetSchema(java.lang.String schema)voidsetTransactionIsolation(int level)voidsetTxBoundNoUserTA()voidsetTxBoundUserTA(java.lang.Integer isolationLevel)voidsetTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> arg0)java.lang.StringtoString()voidunsetTxBound()<T> Tunwrap(java.lang.Class<T> arg0)protected java.sql.PreparedStatementwrapPreparedStatement(java.sql.PreparedStatement pstmt, java.lang.String sql)returns a wrapped PreparedStatement-
Methods inherited from class de.hybris.platform.jdbcwrapper.WrapperRelease
addResource, releaseResources, removeResource
-
-
-
-
Constructor Detail
-
ConnectionImpl
public ConnectionImpl(HybrisDataSource dataSource, java.sql.Connection connection)
-
-
Method Detail
-
gotError
protected boolean gotError()
-
hasBeenRollbacked
protected boolean hasBeenRollbacked()
-
notifyError
protected void notifyError(java.sql.SQLException cause)
-
logError
protected void logError(java.sql.SQLException e, java.lang.String message)
-
getConnectionInfo
protected java.lang.String getConnectionInfo()
-
protectReadOnly
protected void protectReadOnly(java.lang.String sql) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
assureWritable
protected void assureWritable() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getDataSource
public HybrisDataSource getDataSource()
-
invalidate
public void invalidate()
-
unsetTxBound
public void unsetTxBound()
-
restoreAutoCommit
protected void restoreAutoCommit()
-
restoreTxIsolationLevel
protected void restoreTxIsolationLevel()
-
autoRollbackOnUnsetTxBOund
protected void autoRollbackOnUnsetTxBOund()
-
setTxBoundNoUserTA
public void setTxBoundNoUserTA()
-
setTxBoundUserTA
public void setTxBoundUserTA(java.lang.Integer isolationLevel) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
isTxBound
public boolean isTxBound()
-
isTxBoundUserTA
public boolean isTxBoundUserTA()
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfacejava.sql.Connection
-
prepareForUse
public void prepareForUse()
-
restoreAfterUse
public void restoreAfterUse() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
closeUnderlayingConnection
public void closeUnderlayingConnection() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getUnderlayingConnection
public java.sql.Connection getUnderlayingConnection()
returns the underlying physical java.sql.Connection- Returns:
- the connection
-
getConnectionID
public int getConnectionID()
returns the connection ID which is a unique ID which is counted up after each creation of a new connection- Returns:
- the connID
-
wrapPreparedStatement
protected java.sql.PreparedStatement wrapPreparedStatement(java.sql.PreparedStatement pstmt, java.lang.String sql)returns a wrapped PreparedStatement
-
isFlexibleSyntax
protected boolean isFlexibleSyntax(java.lang.String query) throws java.sql.SQLExceptionlogic for recognizing if 'query has' flexible search syntax if { or } happends to ba after from else in first 20 signs of the query - less reliable- Specified by:
isFlexibleSyntaxin classWrapperRelease<java.sql.Statement>- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLExceptionif this connection is not TX bound, it is returned to the JDBC Connection pool If it is TX bound, we do nothing, because the next DataSourceImpl.getConnection() will return exactly this connection. It will then be closed if the connection is committed or rollbacked.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection- Throws:
java.sql.SQLException- if the connection was already closed before
-
notifyStatementClosed
protected void notifyStatementClosed(StatementImpl stmt)
-
releaseResourceImpl
protected void releaseResourceImpl(java.sql.Statement resource) throws java.sql.SQLException- Specified by:
releaseResourceImplin classWrapperRelease<java.sql.Statement>- Parameters:
resource- abstracts, release mechanism for underlying resource any specific implementation for release resources should add here- Throws:
java.sql.SQLException
-
parseQuery
public java.lang.String parseQuery(java.lang.String queryIn) throws java.sql.SQLException- Specified by:
parseQueryin interfaceParsedStatement- Parameters:
queryIn- query to be parsed in flex-mode implementation- Returns:
- parsed query into plain sql for underlying DB to perform on
- Throws:
java.sql.SQLException- is thrown if during parsing something goes wrong
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException- Specified by:
setAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLException- Specified by:
getAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
commitInternal
protected void commitInternal() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
rollbackInternal
protected void rollbackInternal() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
rollback
public void rollback(java.sql.Savepoint savePoint) throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException- Specified by:
getMetaDatain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException- Specified by:
getCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException- Specified by:
setCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getHoldability
public int getHoldability() throws java.sql.SQLException- Specified by:
getHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setHoldability
public void setHoldability(int holdability) throws java.sql.SQLException- Specified by:
setHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTransactionIsolation
public int getTransactionIsolation() throws java.sql.SQLException- Specified by:
getTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLException- Specified by:
setTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTypeMap
public java.util.Map getTypeMap() throws java.sql.SQLException- Specified by:
getTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLException- Specified by:
isReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setReadOnly
public void setReadOnly(boolean readOnly) throws java.sql.SQLException- Specified by:
setReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
releaseSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException- Specified by:
nativeSQLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setTypeMap
public void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> arg0) throws java.sql.SQLException- Specified by:
setTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createBlob
public java.sql.Blob createBlob() throws java.sql.SQLException- Specified by:
createBlobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createClob
public java.sql.Clob createClob() throws java.sql.SQLException- Specified by:
createClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createNClob
public java.sql.NClob createNClob() throws java.sql.SQLException- Specified by:
createNClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createSQLXML
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException- Specified by:
createSQLXMLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.util.Properties getClientInfo() throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.lang.String getClientInfo(java.lang.String arg0) throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isValid
public boolean isValid(int timeout) throws java.sql.SQLException- Specified by:
isValidin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> arg0) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
createArrayOf
public java.sql.Array createArrayOf(java.lang.String arg0, java.lang.Object[] arg1) throws java.sql.SQLException- Specified by:
createArrayOfin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String arg0, java.lang.Object[] arg1) throws java.sql.SQLException- Specified by:
createStructin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setClientInfo
public void setClientInfo(java.util.Properties arg0) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
setClientInfo
public void setClientInfo(java.lang.String arg0, java.lang.String arg1) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
unwrap
public <T> T unwrap(java.lang.Class<T> arg0) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
resetError
public void resetError()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setSchema
public void setSchema(java.lang.String schema) throws java.sql.SQLException- Specified by:
setSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException- Since:
- jdk 1.7
-
getSchema
public java.lang.String getSchema() throws java.sql.SQLException- Specified by:
getSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException- Since:
- jdk 1.7
-
abort
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException- Specified by:
abortin interfacejava.sql.Connection- Throws:
java.sql.SQLException- Since:
- jdk 1.7
-
setNetworkTimeout
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException- Specified by:
setNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException- Since:
- jdk 1.7
-
getNetworkTimeout
public int getNetworkTimeout() throws java.sql.SQLException- Specified by:
getNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException- Since:
- jdk 1.7
-
-