Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

safejdbc
Class TxDataSourceAdapter  view TxDataSourceAdapter download TxDataSourceAdapter.java

java.lang.Object
  extended bysafejdbc.DataSourceAdapter
      extended bysafejdbc.TxDataSourceAdapter
All Implemented Interfaces:
ConnectionProvider

public class TxDataSourceAdapter
extends DataSourceAdapter

Some J2EE environments (e.g. BEA Weblogic 7.0) are providing DataSources with special behaviors (i.e. Connections provided by these DataSources are throwing an Exception when "commit" or "rollback" is invoked).
The TxDataSourceAdapter wrapps such "special" DataSources and returns Proxy-Connections to the framework, wich are ignoring calls to "commit" or "rollback".
As a rule of thumb, you should use a TxDataSourceAdapter, when transactions are managed "externaly" (e.g. by a J2EE container).


Nested Class Summary
private static class TxDataSourceAdapter.ProxyConnectionHandler
          This class uses dynamic proxy functionality to ignore calls to "commit" or "rollback" on a Connection.
 
Field Summary
private static java.lang.ClassLoader _classLoader
           
private static java.lang.Class[] CONNECTION_CLASS
           
 
Fields inherited from class safejdbc.DataSourceAdapter
 
Constructor Summary
TxDataSourceAdapter(javax.sql.DataSource datasource)
           
 
Method Summary
 java.sql.Connection getConnection()
          This method is called to actually give the connection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION_CLASS

private static final java.lang.Class[] CONNECTION_CLASS

_classLoader

private static final java.lang.ClassLoader _classLoader
Constructor Detail

TxDataSourceAdapter

public TxDataSourceAdapter(javax.sql.DataSource datasource)
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from interface: ConnectionProvider
This method is called to actually give the connection

Specified by:
getConnection in interface ConnectionProvider
Overrides:
getConnection in class DataSourceAdapter