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.ComponentOsversionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//w w w.  ja  va 2  s.co m
        dao.deleteCompoOsversionMonthByKey(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.ComponentResolutionServiceImpl.java

License:Apache License

public int insertBatchComponentResolutionDay(List<CompoResolutionAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoResolutionAll insert = it.next();
                dao.insertCompoResolutionDay(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.ComponentResolutionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//from   w w  w.  java2s  .co  m
        dao.deleteCompoResolutionDayByKey(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.ComponentResolutionServiceImpl.java

License:Apache License

public int insertBatchComponentResolutionWeek(List<CompoResolutionAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoResolutionAll insert = it.next();
                dao.insertCompoResolutionWeek(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.ComponentResolutionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from w ww .ja  v  a  2s .  com*/
        dao.deleteCompoResolutionWeekByKey(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.ComponentResolutionServiceImpl.java

License:Apache License

public int insertBatchComponentResolutionMonth(List<CompoResolutionAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }//from w w w . ja v a 2 s  . co m

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoResolutionAll insert = it.next();
                dao.insertCompoResolutionMonth(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.ComponentResolutionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//w  w  w. jav  a  2  s .  c  o  m
        dao.deleteCompoResolutionMonthByKey(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.ComponentSessionServiceImpl.java

License:Apache License

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

    if (in_volist == null) {
        return 0;
    }/*from  w w  w.  ja v a2 s . co  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.insertCompoSessionDay(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 deleteComponentSessionDayByDate(String year, String month, String day) 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  . ja v a  2  s. c  om*/
        dao.deleteCompoSessionDayByKey(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.ComponentSessionServiceImpl.java

License:Apache License

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

    if (in_volist == null) {
        return 0;
    }/*from w ww .  ja v a  2s  .  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.insertCompoSessionWeek(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;
}