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

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

Introduction

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

Prototype

void rollback();

Source Link

Document

Discards pending batch statements and rolls database connection back.

Usage

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentSessionServiceImpl.java

License:Apache License

public int deleteComponentSessionWeekByDate(String year, String week) throws Exception {

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentSessionDao dao = session.getMapper(ComponentSessionDao.class);

    boolean has_error = false;

    try {/*from   www .  ja va2s.c o  m*/
        dao.deleteCompoSessionWeekByKey(year, week, "", "");
        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentSessionServiceImpl.java

License:Apache License

public int insertBatchComponentSessionMonth(List<CompoSessionAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/*from w w w. j  a va2  s .  c  o  m*/

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentSessionDao dao = session.getMapper(ComponentSessionDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

            Iterator<CompoSessionAll> it = in_volist.iterator();

            while (it.hasNext()) {
                CompoSessionAll insert = it.next();
                dao.insertCompoSessionMonth(insert);
            }
        }

        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentSessionServiceImpl.java

License:Apache License

public int deleteComponentSessionMonthByDate(String year, String month) throws Exception {

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentSessionDao dao = session.getMapper(ComponentSessionDao.class);

    boolean has_error = false;

    try {//from   w w  w.  j a va  2s  .c  o m
        dao.deleteCompoSessionMonthByKey(year, month, "", "");
        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int insertBatchComponentTimeDay(List<CompoTimeAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }//from ww  w . j  a  v a 2s .  com

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

            Iterator<CompoTimeAll> it = in_volist.iterator();

            while (it.hasNext()) {
                CompoTimeAll insert = it.next();
                dao.insertCompoTimeDay(insert);
            }
        }

        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int deleteComponentTimeDayByDate(String year, String month, String day) throws Exception {

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {/* w  w  w.ja  va 2 s  .  c o m*/
        dao.deleteCompoTimeDayByKey(year, month, day, "", "");
        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int insertBatchComponentTimeWeek(List<CompoTimeAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/*from w w  w  . j a v  a 2  s  .  com*/

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

            Iterator<CompoTimeAll> it = in_volist.iterator();

            while (it.hasNext()) {
                CompoTimeAll insert = it.next();
                dao.insertCompoTimeWeek(insert);
            }
        }

        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int deleteComponentTimeWeekByDate(String year, String week) throws Exception {

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {/*from w  w  w  .  ja  va  2  s  .c om*/
        dao.deleteCompoTimeWeekByKey(year, week, "", "");
        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int insertBatchComponentTimeMonth(List<CompoTimeAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/*from ww  w. j  a  va 2 s.c om*/

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

            Iterator<CompoTimeAll> it = in_volist.iterator();

            while (it.hasNext()) {
                CompoTimeAll insert = it.next();
                dao.insertCompoTimeMonth(insert);
            }
        }

        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentTimeServiceImpl.java

License:Apache License

public int deleteComponentTimeMonthByDate(String year, String month) throws Exception {

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentTimeDao dao = session.getMapper(ComponentTimeDao.class);

    boolean has_error = false;

    try {// ww w  . j av  a  2 s  .  c o m
        dao.deleteCompoTimeMonthByKey(year, month, "", "");
        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}

From source file:ph.fingra.hadoop.dbms.parts.component.service.ComponentUserServiceImpl.java

License:Apache License

public int insertBatchComponentUserDay(List<CompoUserAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/* w ww . j  a  va 2  s. c  om*/

    SqlSession session = ConnectionFactory.getSession().openSession(ExecutorType.BATCH, false);
    ComponentUserDao dao = session.getMapper(ComponentUserDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

            Iterator<CompoUserAll> it = in_volist.iterator();

            while (it.hasNext()) {
                CompoUserAll insert = it.next();
                dao.insertCompoUserDay(insert);
            }
        }

        List<BatchResult> results = session.flushStatements();
        results.clear();
    } catch (Exception e) {
        has_error = true;
        session.rollback();
        session.close();
        throw e;
    } finally {
        if (has_error == false)
            session.commit();
        session.close();
    }

    return (has_error == false) ? 1 : 0;
}