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

License:Apache License

public int insertBatchComponentOsversionMonth(List<CompoOsversionAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }//  ww w  . ja  va2s.  c o  m

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                CompoOsversionAll insert = it.next();
                dao.insertCompoOsversionMonth(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.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 {/*from  w w w . jav  a  2s .  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;
    }//from w w w .j  av  a 2  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 ww  .j ava  2 s.  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 av  a 2 s. 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 w  w .  j av a 2  s .co m*/
        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;
    }/*w  ww .j  a v  a  2 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.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 {/* www . j  a  v  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;
    }/*www .  j  av a2  s.com*/

    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 o m
        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;
}