bitronix.tm.resource.jdbc
Class JdbcPreparedStatementHandle

java.lang.Object
  extended by bitronix.tm.resource.jdbc.BaseProxyHandlerClass
      extended by bitronix.tm.resource.jdbc.JdbcPreparedStatementHandle
All Implemented Interfaces:
InvocationHandler

public class JdbcPreparedStatementHandle
extends BaseProxyHandlerClass

Caching PreparedStatement wrapper.

This class is a proxy handler for a PreparedStatement. It does not implement the PreparedStatement interface or extend a class directly, but you methods implemented here will override those of the underlying delegate. Simply implement a method with the same signature, and the local method will be called rather than the delegate.

Author:
lorban, brettw

Constructor Summary
JdbcPreparedStatementHandle(String sql)
           
JdbcPreparedStatementHandle(String sql, int autoGeneratedKeys)
           
JdbcPreparedStatementHandle(String sql, int[] columnIndexes)
           
JdbcPreparedStatementHandle(String sql, int resultSetType, int resultSetConcurrency)
           
JdbcPreparedStatementHandle(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
JdbcPreparedStatementHandle(String sql, String[] columnNames)
           
 
Method Summary
 void close()
           
 boolean equals(Object obj)
          Overridden equals() that takes all PreparedStatement attributes into account.
protected  PreparedStatement getDelegateUnchecked()
           
protected  JdbcPooledConnection getPooledConnection()
           
 Object getProxiedDelegate()
          Must be implemented by the sub-class of this class.
 int hashCode()
           
 boolean isClosed()
           
 boolean isWrapperFor(Class<?> iface)
           
protected  void setDelegate(PreparedStatement delegate)
           
protected  void setPooledConnection(JdbcPooledConnection pooledConnection)
          Set the parent connection that created this statement.
 String toString()
           
<T> T
unwrap(Class<T> iface)
           
 
Methods inherited from class bitronix.tm.resource.jdbc.BaseProxyHandlerClass
invoke
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql)

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql,
                                   int autoGeneratedKeys)

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql,
                                   int resultSetType,
                                   int resultSetConcurrency)

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql,
                                   int resultSetType,
                                   int resultSetConcurrency,
                                   int resultSetHoldability)

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql,
                                   int[] columnIndexes)

JdbcPreparedStatementHandle

public JdbcPreparedStatementHandle(String sql,
                                   String[] columnNames)
Method Detail

isWrapperFor

public boolean isWrapperFor(Class<?> iface)
                     throws SQLException
Throws:
SQLException

unwrap

public <T> T unwrap(Class<T> iface)
         throws SQLException
Throws:
SQLException

setPooledConnection

protected void setPooledConnection(JdbcPooledConnection pooledConnection)
Set the parent connection that created this statement. We need this to return the PreparedStatement to the pool.

Parameters:
pooledConnection - the parent JdbcPooledConnection

getPooledConnection

protected JdbcPooledConnection getPooledConnection()

getDelegateUnchecked

protected PreparedStatement getDelegateUnchecked()

setDelegate

protected void setDelegate(PreparedStatement delegate)

getProxiedDelegate

public Object getProxiedDelegate()
                          throws Exception
Description copied from class: BaseProxyHandlerClass
Must be implemented by the sub-class of this class. This method should return the "true" object to be delegated to in the case that the method is not overridden by the sub-class.

Specified by:
getProxiedDelegate in class BaseProxyHandlerClass
Returns:
the true delegate object
Throws:
Exception - can throw any exception if desired

equals

public boolean equals(Object obj)
Overridden equals() that takes all PreparedStatement attributes into account.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

close

public void close()
           throws SQLException
Throws:
SQLException

isClosed

public boolean isClosed()
                 throws SQLException
Throws:
SQLException


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.