sqlg2.db
Class FakeInternalTransaction

java.lang.Object
  extended by sqlg2.db.FakeInternalTransaction
All Implemented Interfaces:
InternalTransaction

public class FakeInternalTransaction
extends java.lang.Object
implements InternalTransaction

This class can be used to call SQLG code from JDBC code. If you have Connection instance then you can retrieve local business interface LITest in the following way:

 Connection conn = ...;
 InternalTransaction trans = new FakeInternalTransaction(conn, new OracleDBSpecific());
 LITest iface = new ImplMapper(trans).getInlineInterface(LITest.class);
 
Returned implementaion will call commitImmediate() or rollbackImmediate() methods after business method invocation success or failure respectively. By default these methods do nothing, and you can override them to control transactional behaviour of business methods. Other than that no transaction control is performed, so you should commit/rollback or use auto-commit on Connection yourself.


Constructor Summary
FakeInternalTransaction(java.sql.Connection conn, DBSpecific specific)
           
FakeInternalTransaction(java.sql.Connection conn, DBSpecific specific, SqlTrace sqlTrace)
           
 
Method Summary
 void commitImmediate()
           
 java.sql.Connection getConnection()
           
 java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Constructor<?>> getImplMap()
           
 java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Method> getMethodMap()
           
 java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Constructor<?>> getRemoteMap(ImplMode implMode)
           
 DBSpecific getSpecific()
           
 SqlTrace getSqlTrace()
           
 void printStackTrace(java.lang.Throwable th)
           
 void rollbackImmediate()
           
 void trace(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FakeInternalTransaction

public FakeInternalTransaction(java.sql.Connection conn,
                               DBSpecific specific)

FakeInternalTransaction

public FakeInternalTransaction(java.sql.Connection conn,
                               DBSpecific specific,
                               SqlTrace sqlTrace)
Method Detail

getConnection

public java.sql.Connection getConnection()
Specified by:
getConnection in interface InternalTransaction

commitImmediate

public void commitImmediate()
Specified by:
commitImmediate in interface InternalTransaction

rollbackImmediate

public void rollbackImmediate()
Specified by:
rollbackImmediate in interface InternalTransaction

getRemoteMap

public java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Constructor<?>> getRemoteMap(ImplMode implMode)
Specified by:
getRemoteMap in interface InternalTransaction

getImplMap

public java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Constructor<?>> getImplMap()
Specified by:
getImplMap in interface InternalTransaction

getMethodMap

public java.util.concurrent.ConcurrentMap<java.lang.Class<?>,java.lang.reflect.Method> getMethodMap()
Specified by:
getMethodMap in interface InternalTransaction

trace

public void trace(java.lang.String str)
Specified by:
trace in interface InternalTransaction

printStackTrace

public void printStackTrace(java.lang.Throwable th)
Specified by:
printStackTrace in interface InternalTransaction

getSpecific

public DBSpecific getSpecific()
Specified by:
getSpecific in interface InternalTransaction

getSqlTrace

public SqlTrace getSqlTrace()
Specified by:
getSqlTrace in interface InternalTransaction