本文整理了Java中org.apache.ibatis.executor.Executor.getTransaction()
方法的一些代码示例,展示了Executor.getTransaction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.getTransaction()
方法的具体详情如下:
包路径:org.apache.ibatis.executor.Executor
类名称:Executor
方法名:getTransaction
暂无
代码示例来源:origin: abel533/Mapper
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: abel533/Mapper
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public Transaction getTransaction() {
return delegate.getTransaction();
}
代码示例来源:origin: org.mybatis/mybatis
@Override
public Transaction getTransaction() {
return delegate.getTransaction();
}
代码示例来源:origin: org.mybatis/mybatis
@Override
public Connection getConnection() {
try {
return executor.getTransaction().getConnection();
} catch (SQLException e) {
throw ExceptionFactory.wrapException("Error getting a new connection. Cause: " + e, e);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public Connection getConnection() {
try {
return executor.getTransaction().getConnection();
} catch (SQLException e) {
throw ExceptionFactory.wrapException("Error getting a new connection. Cause: " + e, e);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: ldlqdsdcn/eidea4
@Override
public Transaction getTransaction() {
return executor.getTransaction();
}
代码示例来源:origin: org.mybatis/mybatis
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: org.apache.ibatis/ibatis-core
public Transaction getTransaction() {
return delegate.getTransaction();
}
代码示例来源:origin: org.apache.ibatis/ibatis-core
public Connection getConnection() {
return executor.getTransaction().getConnection();
}
代码示例来源:origin: org.apache.ibatis/ibatis-core
private void processGeneratedKeys(Executor executor, MappedStatement ms, Statement stmt, Object parameter) {
try {
final Configuration configuration = ms.getConfiguration();
if (parameter != null) {
String keyStatementName = ms.getId() + SELECT_KEY_SUFFIX;
if (configuration.hasStatement(keyStatementName)) {
if (keyStatement != null) {
String keyProperty = keyStatement.getKeyProperty();
final MetaObject metaParam = configuration.newMetaObject(parameter);
if (keyProperty != null && metaParam.hasSetter(keyProperty)) {
// Do not close keyExecutor.
// The transaction will be closed by parent executor.
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() > 1) {
throw new ExecutorException("Select statement for SelectKeyGenerator returned more than one value.");
}
metaParam.setValue(keyProperty, values.get(0));
}
}
}
}
} catch (Exception e) {
throw new ExecutorException("Error selecting key or setting result to parameter object. Cause: " + e, e);
}
}
代码示例来源:origin: miemiedev/mybatis-paginator
public Object call() throws Exception {
Integer count;
Cache cache = ms.getCache();
if(cache != null && ms.isUseCache() && ms.getConfiguration().isCacheEnabled()){
CacheKey cacheKey = executor.createCacheKey(ms,parameter,new PageBounds(),copyFromBoundSql(ms,boundSql,dialect.getCountSQL(), boundSql.getParameterMappings(), boundSql.getParameterObject()));
count = (Integer)cache.getObject(cacheKey);
if(count == null){
count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
cache.putObject(cacheKey, count);
}
}else{
count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
}
return new Paginator(pageBounds.getPage(), pageBounds.getLimit(), count);
}
};
代码示例来源:origin: com.github.miemiedev/mybatis-paginator
public Object call() throws Exception {
Integer count;
Cache cache = ms.getCache();
if(cache != null && ms.isUseCache() && ms.getConfiguration().isCacheEnabled()){
CacheKey cacheKey = executor.createCacheKey(ms,parameter,new PageBounds(),copyFromBoundSql(ms,boundSql,dialect.getCountSQL(), boundSql.getParameterMappings(), boundSql.getParameterObject()));
count = (Integer)cache.getObject(cacheKey);
if(count == null){
count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
cache.putObject(cacheKey, count);
}
}else{
count = SQLHelp.getCount(ms,executor.getTransaction(),parameter,boundSql,dialect);
}
return new Paginator(pageBounds.getPage(), pageBounds.getLimit(), count);
}
};
代码示例来源:origin: tk.mybatis/mapper-core
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: com.hand.hap.cloud/hap-mybatis-mapper-starter
Executor keyExecutor = configuration.newExecutor(executor.getTransaction(), ExecutorType.SIMPLE);
List<Object> values = keyExecutor.query(keyStatement, parameter, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
if (values.size() == 0) {
代码示例来源:origin: com.hand.hap.cloud/hap-mybatis-mapper-starter
@Override
public Object intercept(Invocation invocation) throws Throwable {
Object target = invocation.getTarget();
if (target instanceof Executor) {
Executor executor = (Executor) target;
MappedStatement statement = (MappedStatement) invocation.getArgs()[0];
Object parameter = invocation.getArgs()[1];
EntityTable table = EntityHelper.getTableByMapper(MapperTemplate.getMapperClassName(statement.getId()));
if(table != null && table.isMultiLanguage()){
Object obj = invocation.proceed();
Connection connection = executor.getTransaction().getConnection();
switch (statement.getSqlCommandType()){
case INSERT:
insertMultiLanguage(table,parameter,connection);
break;
case UPDATE:
updateMultiLanguage(table,parameter,connection);
break;
case DELETE:
proceedDeleteMultiLanguage(table,parameter,connection);
break;
}
return obj;
}
}
return invocation.proceed();
}
内容来源于网络,如有侵权,请联系作者删除!