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

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

Introduction

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

Prototype

List<BatchResult> flushStatements();

Source Link

Document

Flushes batch statements.

Usage

From source file:ph.fingra.hadoop.dbms.parts.distribution.service.CountrySessionlengthServiceImpl.java

License:Apache License

public int insertBatchCountrySessionlengthMonth(List<CountrySessionlengthAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CountrySessionlengthAll insert = it.next();
                dao.insertCountrySessionlengthMonth(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.distribution.service.CountrySessionlengthServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from   w  w w  . j  a v  a 2  s . c  om*/
        dao.deleteCountrySessionlengthMonthByKey(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

public int insertBatchCountrySessionDay(List<CountrySessionAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CountrySessionAll insert = it.next();
                dao.insertCountrySessionDay(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from w  ww.  java2  s.c om*/
        dao.deleteCountrySessionDayByKey(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

public int insertBatchCountrySessionWeek(List<CountrySessionAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/* w ww.  j ava2s  .  c  o m*/

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CountrySessionAll insert = it.next();
                dao.insertCountrySessionWeek(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from w  w  w  .  j a v  a  2s  .c o  m*/
        dao.deleteCountrySessionWeekByKey(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

public int insertBatchCountrySessionMonth(List<CountrySessionAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CountrySessionAll insert = it.next();
                dao.insertCountrySessionMonth(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.distribution.service.CountrySessionServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*www.  j a va  2 s.co  m*/
        dao.deleteCountrySessionMonthByKey(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.distribution.service.CountryTimeServiceImpl.java

License:Apache License

public int insertBatchCountryTimeDay(List<CountryTimeAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CountryTimeAll insert = it.next();
                dao.insertCountryTimeDay(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.distribution.service.CountryTimeServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//  ww w .j a v a2s .  com
        dao.deleteCountryTimeDayByKey(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;
}