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

License:Apache License

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

    if (in_volist == null) {
        return 0;
    }//from  w  ww  .ja va  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.insertCountryTimeWeek(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 deleteCountryTimeWeekByDate(String year, String week) throws Exception {

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

    boolean has_error = false;

    try {/*from w w w .  j  a  v  a 2 s  .com*/
        dao.deleteCountryTimeWeekByKey(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.CountryTimeServiceImpl.java

License:Apache License

public int insertBatchCountryTimeMonth(List<CountryTimeAll> 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);
    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.insertCountryTimeMonth(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 deleteCountryTimeMonthByDate(String year, String month) throws Exception {

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

    boolean has_error = false;

    try {/*from  w  w w  . jav a 2 s  .c  o m*/
        dao.deleteCountryTimeMonthByKey(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.DeviceServiceImpl.java

License:Apache License

public int insertBatchDeviceDay(List<DeviceAll> in_volist) throws Exception {

    if (in_volist == null) {
        return 0;
    }/*from  w  w  w. ja v a2s.  c o  m*/

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                DeviceAll insert = it.next();
                dao.insertDeviceDay(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.DeviceServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from ww  w .  jav a  2s.  com*/
        dao.deleteDeviceDayByKey(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.DeviceServiceImpl.java

License:Apache License

public int insertBatchDeviceWeek(List<DeviceAll> in_volist) throws Exception {

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

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

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                DeviceAll insert = it.next();
                dao.insertDeviceWeek(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.DeviceServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from  ww w . j a v  a2 s  .  co  m*/
        dao.deleteDeviceWeekByKey(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.DeviceServiceImpl.java

License:Apache License

public int insertBatchDeviceMonth(List<DeviceAll> 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);
    DeviceDao dao = session.getMapper(DeviceDao.class);

    boolean has_error = false;

    try {

        if (in_volist != null) {

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

            while (it.hasNext()) {
                DeviceAll insert = it.next();
                dao.insertDeviceMonth(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.DeviceServiceImpl.java

License:Apache License

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

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

    boolean has_error = false;

    try {/*from  w  ww . j  a  v  a 2 s.c  o  m*/
        dao.deleteDeviceMonthByKey(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;
}