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:com.sec.ose.airs.persistence.SPDXMapperImpl.java

License:Open Source License

@Override
public List<SPDXPackageDTO> getPackageList() {
    SqlSession session = factory.openSession(true);
    List<SPDXPackageDTO> result;

    try {/*from   ww  w .j av  a 2 s.  c  o m*/
        result = session.selectList("getPackageList");
    } finally {
        session.close();
    }

    return result;
}

From source file:com.spring.dao.CiudadDAOImpl.java

@Override
public List<Ciudad> list() {
    List<Ciudad> list = new ArrayList<Ciudad>();
    SqlSession session = new MyBatisUtil().getSession();
    try {/*from  www. j  a  v a  2 s. c o m*/
        list = session.selectList("Ciudad.list");
    } finally {
        session.close();
    }
    return list;
}

From source file:com.sycros.SCWebConsole.business.dao.LicenseBzDaoImpl.java

License:Open Source License

@Override
public List<String> selectProductList(SqlSession sqlSession) throws Exception {
    // TODO Auto-generated method stub
    return sqlSession.selectList("com.sycros.SCWebConsole.business.business-mapper.selectProductList");

}

From source file:com.tiamaes.mybatis.test.basic.PageHelperTest.java

License:Open Source License

/**
 * ??PageHelper.startPage/*from w ww. j a  v  a  2  s  . co  m*/
 * <p/>
 * startPage??(true)?(false)countstartPagecount
 * <p/>
 * startPage?RowBoundsstartPage
 */
@Test
public void testNamespaceWithStartPage() {
    SqlSession sqlSession = MybatisHelper.getSqlSession();

    try {
        //?110?count
        PageHelper.startPage(1, 10);
        List<Country> list = sqlSession.selectList("selectAll");
        assertEquals(10, list.size());
        assertEquals(183, ((Pagination<?>) list).getTotal());

        //?210??count
        PageHelper.startPage(2, 10, true);
        list = sqlSession.selectList("selectAll");
        assertEquals(10, list.size());
        assertEquals(183, ((Pagination<?>) list).getTotal());

        //?210??count
        PageHelper.startPage(2, 10, false);
        list = sqlSession.selectList("selectAll");
        assertEquals(10, list.size());
        assertEquals(-1, ((Pagination<?>) list).getTotal());

        //?320?count
        PageHelper.startPage(3, 20);
        list = sqlSession.selectList("selectAll");
        assertEquals(20, list.size());
        assertEquals(183, ((Pagination<?>) list).getTotal());
    } finally {
        sqlSession.close();
    }
}

From source file:com.tutorial.ehcachepoc.dao.EmployeeDAO.java

@Override
public List<Employee> getEmployees() {
    logger.info("Getting employees.....");
    SqlSession sqlSession = sqlSessionFactory.openSession();
    List<Employee> results = sqlSession.selectList("retrieveEmployees");
    sqlSession.close();/*w  w w.  j av a2s  .  com*/
    return results;
}

From source file:fr.cph.stock.dao.CompanyDaoImpl.java

License:Apache License

/**
 * Get a list of unsed company// w  ww.ja v  a2s  .co m
 * 
 * @return a list of integer representing company ids.
 */
public final List<Integer> selectAllUnusedCompanyIds() {
    SqlSession session = getSqlSessionFactory();
    List<Integer> companies = null;
    try {
        companies = session.selectList("CompanyDao.selectAllUnusedCompanyIds");
    } finally {
        session.close();
    }
    return companies;
}

From source file:fr.cph.stock.dao.CurrencyDaoImpl.java

License:Apache License

/**
 * Get all currency data//from w  ww  .ja  va  2 s . c  om
 * 
 * @return a list of currency data
 */
public final List<CurrencyData> selectListAllCurrency() {
    SqlSession session = getSqlSessionFactory();
    List<CurrencyData> currencyDataList = null;
    try {
        currencyDataList = session.selectList("CurrencyData.selectListAllCurrencyData");
    } finally {
        session.close();
    }
    return currencyDataList;
}

From source file:fr.cph.stock.dao.UserDaoImpl.java

License:Apache License

/**
 * Get all users// ww w.j  av  a2s .  c o  m
 * 
 * @return a list of user
 */
public final List<User> selectAllUsers() {
    SqlSession session = getSqlSessionFactory();
    List<User> userList = null;
    try {
        userList = session.selectList("UserDao.selectAllUsers");
    } finally {
        session.close();
    }
    return userList;
}

From source file:gp.daoImpl.BusqPreInversionDaoImpl.java

@Override
public List<MostrarDesdeDependencias> mostrarDesdeFacult() {
    SqlSession session = sqlSessionFactory.openSession();
    List<MostrarDesdeDependencias> list = null;
    try {/*from   w  w  w .  ja  va2 s .co m*/
        list = session.selectList("BusqPreInversion.getBPI_7");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL");
    } finally {
        session.close();
    }
    return list;
}

From source file:gp.daoImpl.BusqPreInversionDaoImpl.java

@Override
public List<MostrarDesdeDependencias> mostrarDesdeDepes() {
    SqlSession session = sqlSessionFactory.openSession();
    List<MostrarDesdeDependencias> list = null;
    try {/*from   ww w  . ja  v  a  2 s  .  c  o  m*/
        list = session.selectList("BusqPreInversion.getBPI_8");
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.out.println("ERROR EN EL IMPL");
    } finally {
        session.close();
    }
    return list;
}