Skip to content

Instantly share code, notes, and snippets.

@MikaelAmborn
Created February 15, 2011 20:17
Show Gist options
  • Save MikaelAmborn/828158 to your computer and use it in GitHub Desktop.
Save MikaelAmborn/828158 to your computer and use it in GitHub Desktop.
public class SpringConnection implements Connection {
private final DataSource dataSource;
private final Connection conn;
public SpringConnection(DataSource dataSource, Connection conn) {
this.dataSource = dataSource;
this.conn = conn;
}
public void commit() throws SQLException {
// Do nothing!
}
/**
* calls DataSourceUtils.closeConnectionIfNecessary rather than directly closing the connection
*/
public void close() throws SQLException {
DataSourceUtils.releaseConnection(conn, dataSource);
}
//Lots of methods here that just delegats to the conn instance variable
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment