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

License:Apache License

public int insertBatchComponentFrequencyWeek(List<CompoFrequencyAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoFrequencyAll insert = it.next();
                dao.insertCompoFrequencyWeek(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.ComponentFrequencyServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {// ww  w . j a  va2s  . c  o  m
        dao.deleteCompoFrequencyWeekByKey(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.ComponentFrequencyServiceImpl.java

License:Apache License

public int insertBatchComponentFrequencyMonth(List<CompoFrequencyAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoFrequencyAll insert = it.next();
                dao.insertCompoFrequencyMonth(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.ComponentFrequencyServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from w  ww  . j ava  2 s.  c o m*/
        dao.deleteCompoFrequencyMonthByKey(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.ComponentLanguageServiceImpl.java

License:Apache License

public int insertBatchComponentLanguageDay(List<CompoLanguageAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoLanguageAll insert = it.next();
                dao.insertCompoLanguageDay(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.ComponentLanguageServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//from   w ww.j a  v  a 2  s  . c o m
        dao.deleteCompoLanguageDayByKey(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.ComponentLanguageServiceImpl.java

License:Apache License

public int insertBatchComponentLanguageWeek(List<CompoLanguageAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoLanguageAll insert = it.next();
                dao.insertCompoLanguageWeek(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.ComponentLanguageServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {//  w  w w  . ja  v  a  2s.  c  o  m
        dao.deleteCompoLanguageWeekByKey(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.ComponentLanguageServiceImpl.java

License:Apache License

public int insertBatchComponentLanguageMonth(List<CompoLanguageAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoLanguageAll insert = it.next();
                dao.insertCompoLanguageMonth(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.ComponentLanguageServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from   w ww . j ava  2s  .  c om*/
        dao.deleteCompoLanguageMonthByKey(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;
}