org.apache.ibatis.session.Configuration.newStatementHandler()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.apache.ibatis.session.Configuration.newStatementHandler()方法的一些代码示例,展示了Configuration.newStatementHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.newStatementHandler()方法的具体详情如下:
包路径:org.apache.ibatis.session.Configuration
类名称:Configuration
方法名:newStatementHandler

Configuration.newStatementHandler介绍

暂无

代码示例

代码示例来源:origin: baomidou/mybatis-plus

@Override
public Object intercept(Invocation invocation) throws Throwable {
  Object[] args = invocation.getArgs();
  MappedStatement ms = (MappedStatement) args[0];
  Object parameter = args[1];
  Configuration configuration = ms.getConfiguration();
  Object target = invocation.getTarget();
  StatementHandler handler = configuration.newStatementHandler((Executor) target, ms, parameter, RowBounds.DEFAULT, null, null);
  this.sqlParser(SystemMetaObject.forObject(handler));
  return invocation.proceed();
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.<E>queryCursor(stmt);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.update(stmt);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.<E>query(stmt, resultHandler);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.<E>queryCursor(stmt);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.queryCursor(stmt);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.query(stmt, resultHandler);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 return handler.update(stmt);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
 Statement stmt = null;
 try {
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);
  stmt = prepareStatement(handler, ms.getStatementLog());
  return handler.<E>query(stmt, resultHandler);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
 Statement stmt = null;
 try {
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
  stmt = prepareStatement(handler, ms.getStatementLog());
  return handler.update(stmt);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
 Statement stmt = null;
 try {
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
  stmt = prepareStatement(handler, ms.getStatementLog());
  return handler.update(stmt);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
 Statement stmt = null;
 try {
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);
  stmt = prepareStatement(handler, ms.getStatementLog());
  return handler.query(stmt, resultHandler);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: org.mybatis/mybatis

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Statement stmt = prepareStatement(handler, ms.getStatementLog());
 stmt.closeOnCompletion();
 return handler.queryCursor(stmt);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
 final Configuration configuration = ms.getConfiguration();
 final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null);
 final BoundSql boundSql = handler.getBoundSql();
 final String sql = boundSql.getSql();
 final Statement stmt;
 if (sql.equals(currentSql) && ms.equals(currentStatement)) {
  int last = statementList.size() - 1;
  stmt = statementList.get(last);
  applyTransactionTimeout(stmt);
  handler.parameterize(stmt);//fix Issues 322
  BatchResult batchResult = batchResultList.get(last);
  batchResult.addParameterObject(parameterObject);
 } else {
  Connection connection = getConnection(ms.getStatementLog());
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);    //fix Issues 322
  currentSql = sql;
  currentStatement = ms;
  statementList.add(stmt);
  batchResultList.add(new BatchResult(ms, sql, parameterObject));
 }
 handler.batch(stmt);
 return BATCH_UPDATE_RETURN_VALUE;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
 final Configuration configuration = ms.getConfiguration();
 final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null);
 final BoundSql boundSql = handler.getBoundSql();
 final String sql = boundSql.getSql();
 final Statement stmt;
 if (sql.equals(currentSql) && ms.equals(currentStatement)) {
  int last = statementList.size() - 1;
  stmt = statementList.get(last);
  applyTransactionTimeout(stmt);
  handler.parameterize(stmt);//fix Issues 322
  BatchResult batchResult = batchResultList.get(last);
  batchResult.addParameterObject(parameterObject);
 } else {
  Connection connection = getConnection(ms.getStatementLog());
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);    //fix Issues 322
  currentSql = sql;
  currentStatement = ms;
  statementList.add(stmt);
  batchResultList.add(new BatchResult(ms, sql, parameterObject));
 }
// handler.parameterize(stmt);
 handler.batch(stmt);
 return BATCH_UPDATE_RETURN_VALUE;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 flushStatements();
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Connection connection = getConnection(ms.getStatementLog());
 Statement stmt = handler.prepare(connection, transaction.getTimeout());
 handler.parameterize(stmt);
 return handler.<E>queryCursor(stmt);
}

代码示例来源:origin: org.mybatis/mybatis

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
 flushStatements();
 Configuration configuration = ms.getConfiguration();
 StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
 Connection connection = getConnection(ms.getStatementLog());
 Statement stmt = handler.prepare(connection, transaction.getTimeout());
 stmt.closeOnCompletion();
 handler.parameterize(stmt);
 return handler.queryCursor(stmt);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)
  throws SQLException {
 Statement stmt = null;
 try {
  flushStatements();
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameterObject, rowBounds, resultHandler, boundSql);
  Connection connection = getConnection(ms.getStatementLog());
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);
  return handler.<E>query(stmt, resultHandler);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: org.mybatis/mybatis

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)
  throws SQLException {
 Statement stmt = null;
 try {
  flushStatements();
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameterObject, rowBounds, resultHandler, boundSql);
  Connection connection = getConnection(ms.getStatementLog());
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);
  return handler.query(stmt, resultHandler);
 } finally {
  closeStatement(stmt);
 }
}

代码示例来源:origin: com.baomidou/mybatis-plus-extension

@Override
public Object intercept(Invocation invocation) throws Throwable {
  Object[] args = invocation.getArgs();
  MappedStatement ms = (MappedStatement) args[0];
  Object parameter = args[1];
  Configuration configuration = ms.getConfiguration();
  Object target = invocation.getTarget();
  StatementHandler handler = configuration.newStatementHandler((Executor) target, ms, parameter, RowBounds.DEFAULT, null, null);
  this.sqlParser(SystemMetaObject.forObject(handler));
  return invocation.proceed();
}

相关文章

微信公众号

最新文章

更多

Configuration类方法