Example usage for org.apache.ibatis.session SqlSession update

List of usage examples for org.apache.ibatis.session SqlSession update

Introduction

In this page you can find the example usage for org.apache.ibatis.session SqlSession update.

Prototype

int update(String statement);

Source Link

Document

Execute an update statement.

Usage

From source file:com.baidu.oped.apm.plugin.mybatis.SqlSessionTestBase.java

License:Apache License

protected final void testAndVerifyUpdate() throws Exception {
    // Given//from w  w  w  .  ja  v a  2s.c om
    final String updateId = "updateId";
    SqlSession sqlSession = getSqlSession();
    // When
    sqlSession.update(updateId);
    sqlSession.update(updateId, new Object());
    // Then
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    Method update1 = sqlSession.getClass().getDeclaredMethod("update", String.class);
    Method update2 = sqlSession.getClass().getDeclaredMethod("update", String.class, Object.class);
    verifier.verifyTrace(event("MYBATIS", update1, Expectations.cachedArgs(updateId)));
    verifier.verifyTrace(event("MYBATIS", update2, Expectations.cachedArgs(updateId)));
}

From source file:com.mirth.connect.plugins.datapruner.DataPruner.java

License:Open Source License

private int runDelete(String query, Map<String, Object> params) {
    SqlSession session = SqlConfig.getSqlSessionManager().openSession(true);

    try {//  w ww . jav  a  2s  .c  om
        if (DatabaseUtil.statementExists("initDataPruner", session)) {
            session.update("initDataPruner");
        }

        status.setPruning(true);

        int count = session.delete(query, params);
        return count;
    } finally {
        session.close();
        status.setPruning(false);
    }
}

From source file:gw.jacoco.sqlreport.SQLReportGenerator.java

License:Open Source License

protected static void makeTable(SqlSession session, String sql) {
    try {//from w  w  w  .jav a  2  s  .c  om
        session.update(sql);
    } catch (PersistenceException e) {
        logger.warn("Ignoring error during create table. Statement=" + sql + "\nContinuing... " + e.toString());
    }
}

From source file:net.hasor.db.orm.mybatis3.SqlExecutorTemplate.java

License:Apache License

public int update(final String statement) throws SQLException {
    return this.execute(new SqlSessionCallback<Integer>() {
        public Integer doSqlSession(SqlSession sqlSession) {
            return sqlSession.update(statement);
        }// www .ja  va  2s  .c  o m
    });
}

From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java

@Override
public void actualizarFlac() {
    SqlSession session = sqlSessionFactory.openSession();
    try {//from w  w  w  . jav  a2  s .com
        session.update("Confirmados.update_flac");
        session.commit();
    } finally {
        session.close();
    }
}

From source file:pecosa.daoImpl.TemporalDaoImpl.java

@Override
public void actualizarTemporal() {
    SqlSession session = sqlSessionFactory.openSession();
    try {/*from ww w .ja  v a  2 s.co m*/
        session.update("VistaData.actualizar_temporal");
        session.commit();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    } finally {
        session.close();
    }
}