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

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

Introduction

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

Prototype

<E> List<E> selectList(String statement);

Source Link

Document

Retrieve a list of mapped objects from the statement key and parameter.

Usage

From source file:org.restcomm.connect.dao.mybatis.MybatisProfilesDao.java

License:Open Source License

@Override
public List<Profile> getAllProfiles() throws SQLException {
    final SqlSession session = sessions.openSession();
    try {/*from w  w  w.j a  va 2 s  . c o m*/
        final List<Map<String, Object>> results = session.selectList(namespace + "getAllProfiles");
        final List<Profile> profiles = new ArrayList<Profile>();

        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                profiles.add(toProfile(result));
            }
        }
        return profiles;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisBanListDao.java

License:Open Source License

@Override
public List<BanList> getBanLists() {
    final SqlSession session = sessions.openSession();
    try {//  w ww  . j a  v  a  2  s .c  om
        final List<Map<String, Object>> results = session.selectList(namespace + "getEntries");
        final List<BanList> entrys = new ArrayList<BanList>();
        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                entrys.add(toBanList(result));
            }
        }
        return entrys;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisConnectorsDao.java

License:Open Source License

@Override
public List<Connector> getConnectors() {
    final SqlSession session = sessions.openSession();
    try {/*  w ww  .  jav  a 2 s.  c  o  m*/
        final List<Map<String, Object>> results = session.selectList(namespace + "getEntries");
        final List<Connector> entrys = new ArrayList<Connector>();
        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                entrys.add(toConnector(result));
            }
        }
        return entrys;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisNetworkPointsDao.java

License:Open Source License

@Override
public List<NetworkPoint> getNetworkPoints() {
    final SqlSession session = sessions.openSession();
    try {//from w  ww .j  av  a2  s.c om
        final List<Map<String, Object>> results = session.selectList(namespace + "getEntries");
        final List<NetworkPoint> entrys = new ArrayList<NetworkPoint>();
        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                entrys.add(toNetworkPoint(result));
            }
        }
        return entrys;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisRoutesDao.java

License:Open Source License

@Override
public List<Route> getRoutes() {
    final SqlSession session = sessions.openSession();
    try {/*from ww  w  .  ja  v  a  2  s . com*/
        final List<Map<String, Object>> results = session.selectList(namespace + "getEntries");
        final List<Route> entrys = new ArrayList<Route>();
        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                entrys.add(toRoutingPolicy(result));
            }
        }
        return entrys;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisStatisticsDao.java

License:Open Source License

@Override
public List<Statistics> getRecords() {
    final SqlSession session = sessions.openSession();
    try {/*from w  ww  .  j a  va  2s  .  com*/
        final List<Map<String, Object>> results = session.selectList(namespace + "getEntries");
        final List<Statistics> entrys = new ArrayList<Statistics>();
        if (results != null && !results.isEmpty()) {
            for (final Map<String, Object> result : results) {
                entrys.add(toRecord(result));
            }
        }
        return entrys;
    } finally {
        session.close();
    }
}

From source file:pecosa.daoImpl.ConfirmadosDaoImpl.java

@Override
public List<ProductosConfirmados> getProductosConfirmados() {
    List<ProductosConfirmados> lista = null;
    SqlSession session = sqlSessionFactory.openSession();
    try {//from   ww w. ja  v  a  2 s .co  m
        lista = session.selectList("Confirmados.getProdConfirm");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL GET PV");
    } finally {
        session.close();
    }
    return lista;
}

From source file:pecosa.daoImpl.DistribuidosDaoImpl.java

@Override
public List<ProductosDistribuidos> getListaDistribuidos() {
    List<ProductosDistribuidos> lista = null;
    SqlSession session = sqlSessionFactory.openSession();
    try {/*ww w  .j ava  2  s . c  o m*/
        lista = session.selectList("Distribuidos.getProdDistrib");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL GET PV");
    } finally {
        session.close();
    }
    return lista;
}

From source file:pecosa.daoImpl.ListasGeneralesDaoImpl.java

@Override
public List<Dependencia> getListaDependencias() {
    List<Dependencia> lista = null;
    SqlSession session = sqlSessionFactory.openSession();
    try {//from  w w w . j av a  2 s.  co  m
        lista = session.selectList("ListasGenerales.getDependencias");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL GET PV");
    } finally {
        session.close();
    }
    return lista;
}

From source file:pecosa.daoImpl.ListasGeneralesDaoImpl.java

@Override
public List<String> getCodigoPecosas() {
    List<String> lista = null;
    SqlSession session = sqlSessionFactory.openSession();
    try {/*w  w w .j a  va2 s  .com*/
        lista = session.selectList("ListasGenerales.getPecosas");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL GET PV");
    } finally {
        session.close();
    }
    return lista;
}