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

License:Apache License

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

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

    boolean has_error = false;

    try {//from   w w w .  j  a  v  a2  s.c  o  m
        dao.deleteCompoAppversionDayByKey(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.ComponentAppversionServiceImpl.java

License:Apache License

public int insertBatchComponentAppversionWeek(List<CompoAppversionAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoAppversionAll insert = it.next();
                dao.insertCompoAppversionWeek(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.ComponentAppversionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from  www. j a  v a 2  s  . co  m*/
        dao.deleteCompoAppversionWeekByKey(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.ComponentAppversionServiceImpl.java

License:Apache License

public int insertBatchComponentAppversionMonth(List<CompoAppversionAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }//from  w w  w.  j ava2s .com

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoAppversionAll insert = it.next();
                dao.insertCompoAppversionMonth(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.ComponentAppversionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

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

License:Apache License

public int insertBatchComponentCountryDay(List<CompoCountryAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoCountryAll insert = it.next();
                dao.insertCompoCountryDay(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.ComponentCountryServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {// w  ww . j  a  v  a 2s . com
        dao.deleteCompoCountryDayByKey(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.ComponentCountryServiceImpl.java

License:Apache License

public int insertBatchComponentCountryWeek(List<CompoCountryAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoCountryAll insert = it.next();
                dao.insertCompoCountryWeek(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.ComponentCountryServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*w  ww .ja  v a 2  s.c om*/
        dao.deleteCompoCountryWeekByKey(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.ComponentCountryServiceImpl.java

License:Apache License

public int insertBatchComponentCountryMonth(List<CompoCountryAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }//from www. j  a  v  a  2s  .c  om

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoCountryAll insert = it.next();
                dao.insertCompoCountryMonth(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;
}