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

License:Apache License

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

    if (in_volist == null) {
        return 0;
    }//  w  ww.j  a  v a  2  s  .  co  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.insertCompoAppversionDay(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 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 ww  . j a  va2 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 w  w .j  a va2  s  .  co 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 w  w w  .  j a  va2  s . c  o  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   ww  w .j a  v 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.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 {//from   www. j a  v 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;
    }/*  w  w  w . jav 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.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 {//from  www .  j  a  v a2  s.c  o m
        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 www. ja v a  2  s  .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 {/*from   w ww  .  j a  va 2  s  .c  o m*/
        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;
}