cn.icuter.jsql.executor.TransactionExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsql Show documentation
Show all versions of jsql Show documentation
JDBC framework for writing sql like java programing
The newest version!
package cn.icuter.jsql.executor;
import cn.icuter.jsql.builder.Builder;
import cn.icuter.jsql.exception.JSQLException;
import cn.icuter.jsql.exception.TransactionCommitException;
import cn.icuter.jsql.exception.TransactionRollbackExcetpion;
import cn.icuter.jsql.transaction.DefaultTransaction;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* @author edward
* @since 2018-09-13
*/
public class TransactionExecutor extends DefaultTransaction implements JdbcExecutor {
protected JdbcExecutor jdbcExecutor;
public TransactionExecutor(Connection connection) {
super(connection);
jdbcExecutor = new DefaultJdbcExecutor(connection);
}
@Override
public int execUpdate(Builder builder) throws JSQLException {
try {
return jdbcExecutor.execUpdate(builder);
} catch (JSQLException e) {
setState(State.ERROR);
throw e;
}
}
@Override
public List execQuery(Builder builder, Class clazz) throws JSQLException {
try {
return jdbcExecutor.execQuery(builder, clazz);
} catch (JSQLException e) {
setState(State.ERROR);
throw e;
}
}
@Override
public List