001: /*
002: * TransactionConnection.java
003: *
004: * Created on Jun 27, 2007, 9:31:22 AM
005: *
006: * To change this template, choose Tools | Template Manager
007: * and open the template in the editor.
008: */
009:
010: package it.biobytes.ammentos;
011:
012: import java.sql.Array;
013: import java.sql.Blob;
014: import java.sql.CallableStatement;
015: import java.sql.Clob;
016: import java.sql.Connection;
017: import java.sql.DatabaseMetaData;
018: import java.sql.NClob;
019: import java.sql.PreparedStatement;
020: import java.sql.SQLClientInfoException;
021: import java.sql.SQLException;
022: import java.sql.SQLWarning;
023: import java.sql.SQLXML;
024: import java.sql.Savepoint;
025: import java.sql.Statement;
026: import java.sql.Struct;
027: import java.util.Map;
028: import java.util.Properties;
029:
030: /**
031: *
032: * @author davide
033: */
034: public class TransactionConnection implements java.sql.Connection {
035:
036: private Connection m_connection;
037:
038: public TransactionConnection(Connection delegate) {
039: m_connection = delegate;
040: }
041:
042: public boolean isWrapperFor(Class iface) throws SQLException {
043: return m_connection.isWrapperFor(iface);
044: }
045:
046: public Object unwrap(Class iface) throws SQLException {
047: return m_connection.unwrap(iface);
048: }
049:
050: public Struct createStruct(String typeName, Object[] attributes)
051: throws SQLException {
052: return m_connection.createStruct(typeName, attributes);
053: }
054:
055: public Array createArrayOf(String typeName, Object[] elements)
056: throws SQLException {
057: return m_connection.createArrayOf(typeName, elements);
058: }
059:
060: public Properties getClientInfo() throws SQLException {
061: return m_connection.getClientInfo();
062: }
063:
064: public String getClientInfo(String name) throws SQLException {
065: return m_connection.getClientInfo(name);
066: }
067:
068: public void setClientInfo(Properties properties)
069: throws SQLClientInfoException {
070: m_connection.setClientInfo(properties);
071: }
072:
073: public void setClientInfo(String name, String value)
074: throws SQLClientInfoException {
075: m_connection.setClientInfo(name, value);
076: }
077:
078: public boolean isValid(int timeout) throws SQLException {
079: return m_connection.isValid(timeout);
080: }
081:
082: public SQLXML createSQLXML() throws SQLException {
083: return m_connection.createSQLXML();
084: }
085:
086: public NClob createNClob() throws SQLException {
087: return m_connection.createNClob();
088: }
089:
090: public Blob createBlob() throws SQLException {
091: return m_connection.createBlob();
092: }
093:
094: public Clob createClob() throws SQLException {
095: return m_connection.createClob();
096: }
097:
098: public PreparedStatement prepareStatement(String sql,
099: String[] columnNames) throws SQLException {
100: return m_connection.prepareStatement(sql, columnNames);
101: }
102:
103: public PreparedStatement prepareStatement(String sql,
104: int[] columnIndexes) throws SQLException {
105: return m_connection.prepareStatement(sql, columnIndexes);
106: }
107:
108: public PreparedStatement prepareStatement(String sql,
109: int autoGeneratedKeys) throws SQLException {
110: return m_connection.prepareStatement(sql, autoGeneratedKeys);
111: }
112:
113: public CallableStatement prepareCall(String sql, int resultSetType,
114: int resultSetConcurrency, int resultSetHoldability)
115: throws SQLException {
116: return m_connection.prepareCall(sql, resultSetType,
117: resultSetConcurrency, resultSetHoldability);
118: }
119:
120: public PreparedStatement prepareStatement(String sql,
121: int resultSetType, int resultSetConcurrency,
122: int resultSetHoldability) throws SQLException {
123: return m_connection.prepareStatement(sql, resultSetType,
124: resultSetConcurrency, resultSetHoldability);
125: }
126:
127: public Statement createStatement(int resultSetType,
128: int resultSetConcurrency, int resultSetHoldability)
129: throws SQLException {
130: return m_connection.createStatement(resultSetType,
131: resultSetConcurrency, resultSetHoldability);
132: }
133:
134: public void releaseSavepoint(Savepoint savepoint)
135: throws SQLException {
136: m_connection.releaseSavepoint(savepoint);
137: }
138:
139: public void rollback(Savepoint savepoint) throws SQLException {
140: m_connection.rollback(savepoint);
141: }
142:
143: public Savepoint setSavepoint(String name) throws SQLException {
144: return m_connection.setSavepoint(name);
145: }
146:
147: public Savepoint setSavepoint() throws SQLException {
148: return m_connection.setSavepoint();
149: }
150:
151: public int getHoldability() throws SQLException {
152: return m_connection.getHoldability();
153: }
154:
155: public void setHoldability(int holdability) throws SQLException {
156: m_connection.setHoldability(holdability);
157: }
158:
159: public void setTypeMap(Map<String, Class<?>> map)
160: throws SQLException {
161: m_connection.setTypeMap(map);
162: }
163:
164: public Map<String, Class<?>> getTypeMap() throws SQLException {
165: return m_connection.getTypeMap();
166: }
167:
168: public CallableStatement prepareCall(String sql, int resultSetType,
169: int resultSetConcurrency) throws SQLException {
170: return m_connection.prepareCall(sql, resultSetType,
171: resultSetConcurrency);
172: }
173:
174: public PreparedStatement prepareStatement(String sql,
175: int resultSetType, int resultSetConcurrency)
176: throws SQLException {
177: return m_connection.prepareStatement(sql, resultSetType,
178: resultSetConcurrency);
179: }
180:
181: public Statement createStatement(int resultSetType,
182: int resultSetConcurrency) throws SQLException {
183: return m_connection.createStatement(resultSetType,
184: resultSetConcurrency);
185: }
186:
187: public void clearWarnings() throws SQLException {
188: m_connection.clearWarnings();
189: }
190:
191: public SQLWarning getWarnings() throws SQLException {
192: return m_connection.getWarnings();
193: }
194:
195: public int getTransactionIsolation() throws SQLException {
196: return m_connection.getTransactionIsolation();
197: }
198:
199: public void setTransactionIsolation(int level) throws SQLException {
200: m_connection.setTransactionIsolation(level);
201: }
202:
203: public String getCatalog() throws SQLException {
204: return m_connection.getCatalog();
205: }
206:
207: public void setCatalog(String catalog) throws SQLException {
208: m_connection.setCatalog(catalog);
209: }
210:
211: public boolean isReadOnly() throws SQLException {
212: return m_connection.isReadOnly();
213: }
214:
215: public void setReadOnly(boolean readOnly) throws SQLException {
216: m_connection.setReadOnly(readOnly);
217: }
218:
219: public DatabaseMetaData getMetaData() throws SQLException {
220: return m_connection.getMetaData();
221: }
222:
223: public boolean isClosed() throws SQLException {
224: return m_connection.isClosed();
225: }
226:
227: public void rollback() throws SQLException {
228: m_connection.rollback();
229: }
230:
231: public void commit() throws SQLException {
232: m_connection.commit();
233: }
234:
235: public boolean getAutoCommit() throws SQLException {
236: return m_connection.getAutoCommit();
237: }
238:
239: public void setAutoCommit(boolean autoCommit) throws SQLException {
240: m_connection.setAutoCommit(autoCommit);
241: }
242:
243: public String nativeSQL(String sql) throws SQLException {
244: return m_connection.nativeSQL(sql);
245: }
246:
247: public CallableStatement prepareCall(String sql)
248: throws SQLException {
249: return m_connection.prepareCall(sql);
250: }
251:
252: public PreparedStatement prepareStatement(String sql)
253: throws SQLException {
254: return m_connection.prepareStatement(sql);
255: }
256:
257: public Statement createStatement() throws SQLException {
258: return m_connection.createStatement();
259: }
260:
261: public void close() throws SQLException {
262: // Empty: transaction connections are closed through transactionClose()
263: }
264:
265: public void transactionClose() throws SQLException {
266: m_connection.close();
267: }
268:
269: }
|