
org.apache.ibatis.transaction.managed.ManagedTransaction Maven / Gradle / Ivy
Go to download
The MyBatis SQL mapper framework makes it easier to use a relational database with object-oriented
applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or
annotations. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping
tools.
package org.apache.ibatis.transaction.managed;
import java.sql.Connection;
import java.sql.SQLException;
import org.apache.ibatis.transaction.Transaction;
public class ManagedTransaction implements Transaction {
private Connection connection;
private boolean closeConnection;
public ManagedTransaction(Connection connection, boolean closeConnection) {
this.connection = connection;
this.closeConnection = closeConnection;
}
public Connection getConnection() {
return connection;
}
public void commit() throws SQLException {
// Does nothing
}
public void rollback() throws SQLException {
// Does nothing
}
public void close() throws SQLException {
if (closeConnection) {
connection.close();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy