The Spring Framework

## org.springframework.jdbc.support.nativejdbc
Class XAPoolNativeJdbcExtractor

    java.lang.Object
      org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter
          org.springframework.jdbc.support.nativejdbc.XAPoolNativeJdbcExtractor

All Implemented Interfaces:
  NativeJdbcExtractor

    public class XAPoolNativeJdbcExtractor

extends NativeJdbcExtractorAdapter

Implementation of the `NativeJdbcExtractor` interface for ObjectWeb's XAPool, as shipped with JOTM and used in JOnAS.

Returns underlying native Connections and native PreparedStatements to application code instead of XAPool's wrapper implementations; unwraps the Connection for native Statements and native CallableStatements. The returned JDBC classes can then safely be cast, e.g. to `oracle.jdbc.OracleConnection`.

This NativeJdbcExtractor can be set just to allow working with an XAPool DataSource: If a given object is not an XAPool wrapper, it will be returned as-is.

Since:
  06.02.2004
Author:
  Juergen Hoeller

Constructor Summary
`XAPoolNativeJdbcExtractor()`

Method Summary
`protected Connection` `doGetNativeConnection(Connection con)` Not able to unwrap: return passed-in Connection.
`PreparedStatement` `getNativePreparedStatement(PreparedStatement ps)` Not able to unwrap: return passed-in PreparedStatement.
`boolean` `isNativeConnectionNecessaryForNativeCallableStatements()` Return `true`, as CoreCallableStatement does not allow access to the underlying Connection.
`boolean` `isNativeConnectionNecessaryForNativeStatements()` Return `true`, as CoreStatement does not allow access to the underlying Connection.

Methods inherited from class org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter
`getNativeCallableStatement, getNativeConnection, getNativeConnectionFromStatement, getNativeResultSet, getNativeStatement, isNativeConnectionNecessaryForNativePreparedStatements`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XAPoolNativeJdbcExtractor

    public XAPoolNativeJdbcExtractor()

Method Detail

### isNativeConnectionNecessaryForNativeStatements

    public boolean isNativeConnectionNecessaryForNativeStatements()

  Return `true`, as CoreStatement does not allow access to the underlying Connection.

  Specified by:
    `isNativeConnectionNecessaryForNativeStatements` in interface `NativeJdbcExtractor`
  Overrides:
    `isNativeConnectionNecessaryForNativeStatements` in class `NativeJdbcExtractorAdapter`

### isNativeConnectionNecessaryForNativeCallableStatements

    public boolean isNativeConnectionNecessaryForNativeCallableStatements()

  Return `true`, as CoreCallableStatement does not allow access to the underlying Connection.

  Specified by:
    `isNativeConnectionNecessaryForNativeCallableStatements` in interface `NativeJdbcExtractor`
  Overrides:
    `isNativeConnectionNecessaryForNativeCallableStatements` in class `NativeJdbcExtractorAdapter`

### doGetNativeConnection

    protected Connection doGetNativeConnection(Connection con)
                                        throws SQLException

  Description copied from class: `NativeJdbcExtractorAdapter`
  Not able to unwrap: return passed-in Connection.

  Overrides:
    `doGetNativeConnection` in class `NativeJdbcExtractorAdapter`
  Throws:
    `SQLException`

### getNativePreparedStatement

    public PreparedStatement getNativePreparedStatement(PreparedStatement ps)
                                                 throws SQLException

  Description copied from class: `NativeJdbcExtractorAdapter`
  Not able to unwrap: return passed-in PreparedStatement.

  Specified by:
    `getNativePreparedStatement` in interface `NativeJdbcExtractor`
  Overrides:
    `getNativePreparedStatement` in class `NativeJdbcExtractorAdapter`
  Parameters:
    `ps` - the PreparedStatement handle, potentially wrapped by a connection pool
  Returns:
    the underlying native JDBC PreparedStatement, if possible; else, the original PreparedStatement
  Throws:
    `SQLException` - if thrown by JDBC methods

The Spring Framework

Copyright © 2002-2008 The Spring Framework.