Class PreparedStatementAdaptor

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper

    public class PreparedStatementAdaptor
    extends java.lang.Object
    implements java.sql.PreparedStatement
    Collects parameter bindings from Hibernate core code that expects a JDBC PreparedStatement.
    • Field Summary

      • Fields inherited from interface java.sql.Statement

        CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
    • Constructor Detail

      • PreparedStatementAdaptor

        public PreparedStatementAdaptor()
    • Method Detail

      • getParametersAsArray

        public java.lang.Object[] getParametersAsArray()
      • executeQuery

        public java.sql.ResultSet executeQuery()
        Specified by:
        executeQuery in interface java.sql.PreparedStatement
      • executeUpdate

        public int executeUpdate()
        Specified by:
        executeUpdate in interface java.sql.PreparedStatement
      • setNull

        public void setNull​(int parameterIndex,
                            int sqlType)
        Specified by:
        setNull in interface java.sql.PreparedStatement
      • setBoolean

        public void setBoolean​(int parameterIndex,
                               boolean x)
        Specified by:
        setBoolean in interface java.sql.PreparedStatement
      • setByte

        public void setByte​(int parameterIndex,
                            byte x)
        Specified by:
        setByte in interface java.sql.PreparedStatement
      • setShort

        public void setShort​(int parameterIndex,
                             short x)
        Specified by:
        setShort in interface java.sql.PreparedStatement
      • setInt

        public void setInt​(int parameterIndex,
                           int x)
        Specified by:
        setInt in interface java.sql.PreparedStatement
      • setLong

        public void setLong​(int parameterIndex,
                            long x)
        Specified by:
        setLong in interface java.sql.PreparedStatement
      • setFloat

        public void setFloat​(int parameterIndex,
                             float x)
        Specified by:
        setFloat in interface java.sql.PreparedStatement
      • setDouble

        public void setDouble​(int parameterIndex,
                              double x)
        Specified by:
        setDouble in interface java.sql.PreparedStatement
      • setBigDecimal

        public void setBigDecimal​(int parameterIndex,
                                  java.math.BigDecimal x)
        Specified by:
        setBigDecimal in interface java.sql.PreparedStatement
      • setString

        public void setString​(int parameterIndex,
                              java.lang.String x)
        Specified by:
        setString in interface java.sql.PreparedStatement
      • setBytes

        public void setBytes​(int parameterIndex,
                             byte[] x)
        Specified by:
        setBytes in interface java.sql.PreparedStatement
      • setDate

        public void setDate​(int parameterIndex,
                            java.sql.Date x)
        Specified by:
        setDate in interface java.sql.PreparedStatement
      • setTime

        public void setTime​(int parameterIndex,
                            java.sql.Time x)
        Specified by:
        setTime in interface java.sql.PreparedStatement
      • setTime

        public void setTime​(int parameterIndex,
                            java.sql.Time x,
                            java.util.Calendar cal)
        Specified by:
        setTime in interface java.sql.PreparedStatement
      • setTimestamp

        public void setTimestamp​(int parameterIndex,
                                 java.sql.Timestamp x)
        Specified by:
        setTimestamp in interface java.sql.PreparedStatement
      • setTimestamp

        public void setTimestamp​(int parameterIndex,
                                 java.sql.Timestamp x,
                                 java.util.Calendar cal)
        Specified by:
        setTimestamp in interface java.sql.PreparedStatement
      • setAsciiStream

        public void setAsciiStream​(int parameterIndex,
                                   java.io.InputStream x,
                                   int length)
        Specified by:
        setAsciiStream in interface java.sql.PreparedStatement
      • setUnicodeStream

        public void setUnicodeStream​(int parameterIndex,
                                     java.io.InputStream x,
                                     int length)
        Specified by:
        setUnicodeStream in interface java.sql.PreparedStatement
      • setBinaryStream

        public void setBinaryStream​(int parameterIndex,
                                    java.io.InputStream x,
                                    int length)
        Specified by:
        setBinaryStream in interface java.sql.PreparedStatement
      • clearParameters

        public void clearParameters()
        Specified by:
        clearParameters in interface java.sql.PreparedStatement
      • setObject

        public void setObject​(int parameterIndex,
                              java.lang.Object x,
                              int targetSqlType)
        Specified by:
        setObject in interface java.sql.PreparedStatement
      • setObject

        public void setObject​(int parameterIndex,
                              java.lang.Object x)
        Specified by:
        setObject in interface java.sql.PreparedStatement
      • execute

        public boolean execute()
        Specified by:
        execute in interface java.sql.PreparedStatement
      • addBatch

        public void addBatch()
        Specified by:
        addBatch in interface java.sql.PreparedStatement
      • setCharacterStream

        public void setCharacterStream​(int parameterIndex,
                                       java.io.Reader reader,
                                       int length)
        Specified by:
        setCharacterStream in interface java.sql.PreparedStatement
      • setRef

        public void setRef​(int parameterIndex,
                           java.sql.Ref x)
        Specified by:
        setRef in interface java.sql.PreparedStatement
      • setBlob

        public void setBlob​(int parameterIndex,
                            java.sql.Blob x)
        Specified by:
        setBlob in interface java.sql.PreparedStatement
      • setClob

        public void setClob​(int parameterIndex,
                            java.sql.Clob x)
        Specified by:
        setClob in interface java.sql.PreparedStatement
      • setArray

        public void setArray​(int parameterIndex,
                             java.sql.Array x)
        Specified by:
        setArray in interface java.sql.PreparedStatement
      • getMetaData

        public java.sql.ResultSetMetaData getMetaData()
        Specified by:
        getMetaData in interface java.sql.PreparedStatement
      • setDate

        public void setDate​(int parameterIndex,
                            java.sql.Date x,
                            java.util.Calendar cal)
        Specified by:
        setDate in interface java.sql.PreparedStatement
      • setNull

        public void setNull​(int parameterIndex,
                            int sqlType,
                            java.lang.String typeName)
        Specified by:
        setNull in interface java.sql.PreparedStatement
      • setURL

        public void setURL​(int parameterIndex,
                           java.net.URL x)
        Specified by:
        setURL in interface java.sql.PreparedStatement
      • getParameterMetaData

        public java.sql.ParameterMetaData getParameterMetaData()
        Specified by:
        getParameterMetaData in interface java.sql.PreparedStatement
      • setRowId

        public void setRowId​(int parameterIndex,
                             java.sql.RowId x)
        Specified by:
        setRowId in interface java.sql.PreparedStatement
      • setNString

        public void setNString​(int parameterIndex,
                               java.lang.String value)
        Specified by:
        setNString in interface java.sql.PreparedStatement
      • setNCharacterStream

        public void setNCharacterStream​(int parameterIndex,
                                        java.io.Reader value,
                                        long length)
        Specified by:
        setNCharacterStream in interface java.sql.PreparedStatement
      • setNClob

        public void setNClob​(int parameterIndex,
                             java.sql.NClob value)
        Specified by:
        setNClob in interface java.sql.PreparedStatement
      • setClob

        public void setClob​(int parameterIndex,
                            java.io.Reader reader,
                            long length)
        Specified by:
        setClob in interface java.sql.PreparedStatement
      • setBlob

        public void setBlob​(int parameterIndex,
                            java.io.InputStream inputStream,
                            long length)
        Specified by:
        setBlob in interface java.sql.PreparedStatement
      • setNClob

        public void setNClob​(int parameterIndex,
                             java.io.Reader reader,
                             long length)
        Specified by:
        setNClob in interface java.sql.PreparedStatement
      • setSQLXML

        public void setSQLXML​(int parameterIndex,
                              java.sql.SQLXML xmlObject)
        Specified by:
        setSQLXML in interface java.sql.PreparedStatement
      • setObject

        public void setObject​(int parameterIndex,
                              java.lang.Object x,
                              int targetSqlType,
                              int scaleOrLength)
        Specified by:
        setObject in interface java.sql.PreparedStatement
      • setAsciiStream

        public void setAsciiStream​(int parameterIndex,
                                   java.io.InputStream x,
                                   long length)
        Specified by:
        setAsciiStream in interface java.sql.PreparedStatement
      • setBinaryStream

        public void setBinaryStream​(int parameterIndex,
                                    java.io.InputStream is,
                                    long length)
        Specified by:
        setBinaryStream in interface java.sql.PreparedStatement
      • setCharacterStream

        public void setCharacterStream​(int parameterIndex,
                                       java.io.Reader reader,
                                       long length)
        Specified by:
        setCharacterStream in interface java.sql.PreparedStatement
      • setAsciiStream

        public void setAsciiStream​(int parameterIndex,
                                   java.io.InputStream x)
        Specified by:
        setAsciiStream in interface java.sql.PreparedStatement
      • setBinaryStream

        public void setBinaryStream​(int parameterIndex,
                                    java.io.InputStream x)
        Specified by:
        setBinaryStream in interface java.sql.PreparedStatement
      • setCharacterStream

        public void setCharacterStream​(int parameterIndex,
                                       java.io.Reader reader)
        Specified by:
        setCharacterStream in interface java.sql.PreparedStatement
      • setNCharacterStream

        public void setNCharacterStream​(int parameterIndex,
                                        java.io.Reader value)
        Specified by:
        setNCharacterStream in interface java.sql.PreparedStatement
      • setClob

        public void setClob​(int parameterIndex,
                            java.io.Reader reader)
        Specified by:
        setClob in interface java.sql.PreparedStatement
      • setBlob

        public void setBlob​(int parameterIndex,
                            java.io.InputStream inputStream)
        Specified by:
        setBlob in interface java.sql.PreparedStatement
      • setNClob

        public void setNClob​(int parameterIndex,
                             java.io.Reader reader)
        Specified by:
        setNClob in interface java.sql.PreparedStatement
      • executeQuery

        public java.sql.ResultSet executeQuery​(java.lang.String sql)
        Specified by:
        executeQuery in interface java.sql.Statement
      • executeUpdate

        public int executeUpdate​(java.lang.String sql)
        Specified by:
        executeUpdate in interface java.sql.Statement
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.sql.Statement
      • getMaxFieldSize

        public int getMaxFieldSize()
        Specified by:
        getMaxFieldSize in interface java.sql.Statement
      • setMaxFieldSize

        public void setMaxFieldSize​(int max)
        Specified by:
        setMaxFieldSize in interface java.sql.Statement
      • getMaxRows

        public int getMaxRows()
        Specified by:
        getMaxRows in interface java.sql.Statement
      • setMaxRows

        public void setMaxRows​(int max)
        Specified by:
        setMaxRows in interface java.sql.Statement
      • setEscapeProcessing

        public void setEscapeProcessing​(boolean enable)
        Specified by:
        setEscapeProcessing in interface java.sql.Statement
      • getQueryTimeout

        public int getQueryTimeout()
        Specified by:
        getQueryTimeout in interface java.sql.Statement
      • setQueryTimeout

        public void setQueryTimeout​(int seconds)
        Specified by:
        setQueryTimeout in interface java.sql.Statement
      • cancel

        public void cancel()
        Specified by:
        cancel in interface java.sql.Statement
      • getWarnings

        public java.sql.SQLWarning getWarnings()
        Specified by:
        getWarnings in interface java.sql.Statement
      • clearWarnings

        public void clearWarnings()
        Specified by:
        clearWarnings in interface java.sql.Statement
      • setCursorName

        public void setCursorName​(java.lang.String name)
        Specified by:
        setCursorName in interface java.sql.Statement
      • execute

        public boolean execute​(java.lang.String sql)
        Specified by:
        execute in interface java.sql.Statement
      • getResultSet

        public java.sql.ResultSet getResultSet()
        Specified by:
        getResultSet in interface java.sql.Statement
      • getUpdateCount

        public int getUpdateCount()
        Specified by:
        getUpdateCount in interface java.sql.Statement
      • getMoreResults

        public boolean getMoreResults()
        Specified by:
        getMoreResults in interface java.sql.Statement
      • getFetchDirection

        public int getFetchDirection()
        Specified by:
        getFetchDirection in interface java.sql.Statement
      • setFetchDirection

        public void setFetchDirection​(int direction)
        Specified by:
        setFetchDirection in interface java.sql.Statement
      • getFetchSize

        public int getFetchSize()
        Specified by:
        getFetchSize in interface java.sql.Statement
      • setFetchSize

        public void setFetchSize​(int rows)
        Specified by:
        setFetchSize in interface java.sql.Statement
      • getResultSetConcurrency

        public int getResultSetConcurrency()
        Specified by:
        getResultSetConcurrency in interface java.sql.Statement
      • getResultSetType

        public int getResultSetType()
        Specified by:
        getResultSetType in interface java.sql.Statement
      • addBatch

        public void addBatch​(java.lang.String sql)
        Specified by:
        addBatch in interface java.sql.Statement
      • clearBatch

        public void clearBatch()
        Specified by:
        clearBatch in interface java.sql.Statement
      • executeBatch

        public int[] executeBatch()
        Specified by:
        executeBatch in interface java.sql.Statement
      • getConnection

        public java.sql.Connection getConnection()
        Specified by:
        getConnection in interface java.sql.Statement
      • getMoreResults

        public boolean getMoreResults​(int current)
        Specified by:
        getMoreResults in interface java.sql.Statement
      • getGeneratedKeys

        public java.sql.ResultSet getGeneratedKeys()
        Specified by:
        getGeneratedKeys in interface java.sql.Statement
      • executeUpdate

        public int executeUpdate​(java.lang.String sql,
                                 int autoGeneratedKeys)
        Specified by:
        executeUpdate in interface java.sql.Statement
      • executeUpdate

        public int executeUpdate​(java.lang.String sql,
                                 int[] columnIndexes)
        Specified by:
        executeUpdate in interface java.sql.Statement
      • executeUpdate

        public int executeUpdate​(java.lang.String sql,
                                 java.lang.String[] columnNames)
        Specified by:
        executeUpdate in interface java.sql.Statement
      • execute

        public boolean execute​(java.lang.String sql,
                               int autoGeneratedKeys)
        Specified by:
        execute in interface java.sql.Statement
      • execute

        public boolean execute​(java.lang.String sql,
                               int[] columnIndexes)
        Specified by:
        execute in interface java.sql.Statement
      • execute

        public boolean execute​(java.lang.String sql,
                               java.lang.String[] columnNames)
        Specified by:
        execute in interface java.sql.Statement
      • getResultSetHoldability

        public int getResultSetHoldability()
        Specified by:
        getResultSetHoldability in interface java.sql.Statement
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface java.sql.Statement
      • isPoolable

        public boolean isPoolable()
        Specified by:
        isPoolable in interface java.sql.Statement
      • setPoolable

        public void setPoolable​(boolean poolable)
        Specified by:
        setPoolable in interface java.sql.Statement
      • closeOnCompletion

        public void closeOnCompletion()
        Specified by:
        closeOnCompletion in interface java.sql.Statement
      • isCloseOnCompletion

        public boolean isCloseOnCompletion()
        Specified by:
        isCloseOnCompletion in interface java.sql.Statement
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
        Specified by:
        unwrap in interface java.sql.Wrapper
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
        Specified by:
        isWrapperFor in interface java.sql.Wrapper